Search in sources :

Example 1 with MoveRegionResponse

use of org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.MoveRegionResponse in project hbase by apache.

the class MasterRpcServices method moveRegion.

@Override
public MoveRegionResponse moveRegion(RpcController controller, MoveRegionRequest req) throws ServiceException {
    final byte[] encodedRegionName = req.getRegion().getValue().toByteArray();
    RegionSpecifierType type = req.getRegion().getType();
    final byte[] destServerName = (req.hasDestServerName()) ? Bytes.toBytes(ProtobufUtil.toServerName(req.getDestServerName()).getServerName()) : null;
    MoveRegionResponse mrr = MoveRegionResponse.newBuilder().build();
    if (type != RegionSpecifierType.ENCODED_REGION_NAME) {
        LOG.warn("moveRegion specifier type: expected: " + RegionSpecifierType.ENCODED_REGION_NAME + " actual: " + type);
    }
    try {
        master.checkInitialized();
        master.move(encodedRegionName, destServerName);
    } catch (IOException ioe) {
        throw new ServiceException(ioe);
    }
    return mrr;
}
Also used : ServiceException(org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException) RegionSpecifierType(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.RegionSpecifier.RegionSpecifierType) IOException(java.io.IOException) DoNotRetryIOException(org.apache.hadoop.hbase.DoNotRetryIOException) MoveRegionResponse(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.MoveRegionResponse)

Aggregations

IOException (java.io.IOException)1 DoNotRetryIOException (org.apache.hadoop.hbase.DoNotRetryIOException)1 ServiceException (org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException)1 RegionSpecifierType (org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.RegionSpecifier.RegionSpecifierType)1 MoveRegionResponse (org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.MoveRegionResponse)1