use of org.apache.hadoop.hbase.client.RegionInfo in project hbase by apache.
the class MasterRpcServices method assignRegion.
@Override
public AssignRegionResponse assignRegion(RpcController controller, AssignRegionRequest req) throws ServiceException {
try {
server.checkInitialized();
final RegionSpecifierType type = req.getRegion().getType();
if (type != RegionSpecifierType.REGION_NAME) {
LOG.warn("assignRegion specifier type: expected: " + RegionSpecifierType.REGION_NAME + " actual: " + type);
}
final byte[] regionName = req.getRegion().getValue().toByteArray();
final RegionInfo regionInfo = server.getAssignmentManager().getRegionInfo(regionName);
if (regionInfo == null) {
throw new UnknownRegionException(Bytes.toStringBinary(regionName));
}
final AssignRegionResponse arr = AssignRegionResponse.newBuilder().build();
if (server.cpHost != null) {
server.cpHost.preAssign(regionInfo);
}
LOG.info(server.getClientIdAuditPrefix() + " assign " + regionInfo.getRegionNameAsString());
server.getAssignmentManager().assign(regionInfo);
if (server.cpHost != null) {
server.cpHost.postAssign(regionInfo);
}
return arr;
} catch (IOException ioe) {
throw new ServiceException(ioe);
}
}
use of org.apache.hadoop.hbase.client.RegionInfo in project hbase by apache.
the class AssignmentManager method deleteTable.
/**
* Delete the region states. This is called by "DeleteTable"
*/
public void deleteTable(final TableName tableName) throws IOException {
final ArrayList<RegionInfo> regions = regionStates.getTableRegionsInfo(tableName);
regionStateStore.deleteRegions(regions);
for (int i = 0; i < regions.size(); ++i) {
final RegionInfo regionInfo = regions.get(i);
// we expect the region to be offline
regionStates.removeFromOfflineRegions(regionInfo);
regionStates.deleteRegion(regionInfo);
}
}
use of org.apache.hadoop.hbase.client.RegionInfo in project hbase by apache.
the class AssignmentManager method markRegionAsMerged.
/**
* When called here, the merge has happened. The merged regions have been
* unassigned and the above markRegionClosed has been called on each so they have been
* disassociated from a hosting Server. The merged region will be open after this call. The
* merged regions are removed from hbase:meta below. Later they are deleted from the filesystem
* by the catalog janitor running against hbase:meta. It notices when the merged region no
* longer holds references to the old regions (References are deleted after a compaction
* rewrites what the Reference points at but not until the archiver chore runs, are the
* References removed).
*/
public void markRegionAsMerged(final RegionInfo child, final ServerName serverName, RegionInfo[] mergeParents) throws IOException {
final RegionStateNode node = regionStates.getOrCreateRegionStateNode(child);
node.setState(State.MERGED);
for (RegionInfo ri : mergeParents) {
regionStates.deleteRegion(ri);
}
TableDescriptor td = master.getTableDescriptors().get(child.getTable());
regionStateStore.mergeRegions(child, mergeParents, serverName, td);
if (shouldAssignFavoredNodes(child)) {
getFavoredNodePromoter().generateFavoredNodesForMergedRegion(child, mergeParents);
}
}
use of org.apache.hadoop.hbase.client.RegionInfo in project hbase by apache.
the class AssignmentManager method closeRegionSilently.
/**
* Close <code>regionName</code> on <code>sn</code> silently and immediately without
* using a Procedure or going via hbase:meta. For case where a RegionServer's hosting
* of a Region is not aligned w/ the Master's accounting of Region state. This is for
* cleaning up an error in accounting.
*/
private void closeRegionSilently(ServerName sn, byte[] regionName) {
try {
RegionInfo ri = CatalogFamilyFormat.parseRegionInfoFromRegionName(regionName);
// Pass -1 for timeout. Means do not wait.
ServerManager.closeRegionSilentlyAndWait(this.master.getAsyncClusterConnection(), sn, ri, -1);
} catch (Exception e) {
LOG.error("Failed trying to close {} on {}", Bytes.toStringBinary(regionName), sn, e);
}
}
use of org.apache.hadoop.hbase.client.RegionInfo in project hbase by apache.
the class AssignmentManager method regionClosing.
// should be called under the RegionStateNode lock
void regionClosing(RegionStateNode regionNode) throws IOException {
transitStateAndUpdate(regionNode, State.CLOSING, STATES_EXPECTED_ON_CLOSING);
RegionInfo hri = regionNode.getRegionInfo();
// Set meta has not initialized early. so people trying to create/edit tables will wait
if (isMetaRegion(hri)) {
setMetaAssigned(hri, false);
}
regionStates.addRegionToServer(regionNode);
// update the operation count metrics
metrics.incrementOperationCounter();
}
Aggregations