use of org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.AssignRegionResponse 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);
}
}
Aggregations