Search in sources :

Example 1 with CloseRegionForSplitOrMergeResponse

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);
    }
}
Also used : CloseRegionForSplitOrMergeResponse(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.CloseRegionForSplitOrMergeResponse) ServiceException(org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException) ArrayList(java.util.ArrayList) ByteString(org.apache.hadoop.hbase.shaded.com.google.protobuf.ByteString) InterruptedIOException(java.io.InterruptedIOException) IOException(java.io.IOException) DoNotRetryIOException(org.apache.hadoop.hbase.DoNotRetryIOException) HBaseIOException(org.apache.hadoop.hbase.HBaseIOException) QosPriority(org.apache.hadoop.hbase.ipc.QosPriority)

Aggregations

IOException (java.io.IOException)1 InterruptedIOException (java.io.InterruptedIOException)1 ArrayList (java.util.ArrayList)1 DoNotRetryIOException (org.apache.hadoop.hbase.DoNotRetryIOException)1 HBaseIOException (org.apache.hadoop.hbase.HBaseIOException)1 QosPriority (org.apache.hadoop.hbase.ipc.QosPriority)1 ByteString (org.apache.hadoop.hbase.shaded.com.google.protobuf.ByteString)1 ServiceException (org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException)1 CloseRegionForSplitOrMergeResponse (org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.CloseRegionForSplitOrMergeResponse)1