use of org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.CloseRegionForSplitOrMergeResponse in project hbase by apache.
the class RSRpcServices method closeRegionForSplitOrMerge.
@Override
@QosPriority(priority = HConstants.ADMIN_QOS)
public CloseRegionForSplitOrMergeResponse closeRegionForSplitOrMerge(final RpcController controller, final CloseRegionForSplitOrMergeRequest request) throws ServiceException {
try {
checkOpen();
List<String> encodedRegionNameList = new ArrayList<>();
for (int i = 0; i < request.getRegionCount(); i++) {
final String encodedRegionName = ProtobufUtil.getRegionEncodedName(request.getRegion(i));
// Can be null if we're calling close on a region that's not online
final Region targetRegion = regionServer.getFromOnlineRegions(encodedRegionName);
if ((targetRegion != null) && (targetRegion.getCoprocessorHost() != null)) {
targetRegion.getCoprocessorHost().preClose(false);
encodedRegionNameList.add(encodedRegionName);
}
}
requestCount.increment();
LOG.info("Close and offline " + encodedRegionNameList + " regions.");
boolean closed = regionServer.closeAndOfflineRegionForSplitOrMerge(encodedRegionNameList);
CloseRegionForSplitOrMergeResponse.Builder builder = CloseRegionForSplitOrMergeResponse.newBuilder().setClosed(closed);
return builder.build();
} catch (IOException ie) {
throw new ServiceException(ie);
}
}
Aggregations