use of org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.UnassignRegionResponse in project hbase by apache.
the class MasterRpcServices method unassignRegion.
@Override
public UnassignRegionResponse unassignRegion(RpcController controller, UnassignRegionRequest req) throws ServiceException {
try {
final byte[] regionName = req.getRegion().getValue().toByteArray();
RegionSpecifierType type = req.getRegion().getType();
UnassignRegionResponse urr = UnassignRegionResponse.newBuilder().build();
server.checkInitialized();
if (type != RegionSpecifierType.REGION_NAME) {
LOG.warn("unassignRegion specifier type: expected: " + RegionSpecifierType.REGION_NAME + " actual: " + type);
}
RegionStateNode rsn = server.getAssignmentManager().getRegionStates().getRegionStateNodeFromName(regionName);
if (rsn == null) {
throw new UnknownRegionException(Bytes.toString(regionName));
}
RegionInfo hri = rsn.getRegionInfo();
if (server.cpHost != null) {
server.cpHost.preUnassign(hri);
}
LOG.debug(server.getClientIdAuditPrefix() + " unassign " + hri.getRegionNameAsString() + " in current location if it is online");
server.getAssignmentManager().unassign(hri);
if (server.cpHost != null) {
server.cpHost.postUnassign(hri);
}
return urr;
} catch (IOException ioe) {
throw new ServiceException(ioe);
}
}
Aggregations