Search in sources :

Example 1 with SplitTableRegionRequest

use of org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.SplitTableRegionRequest in project hbase by apache.

the class HRegionServer method requestRegionSplit.

@Override
public long requestRegionSplit(final HRegionInfo regionInfo, final byte[] splitRow) {
    NonceGenerator ng = clusterConnection.getNonceGenerator();
    final long nonceGroup = ng.getNonceGroup();
    final long nonce = ng.newNonce();
    long procId = -1;
    SplitTableRegionRequest request = RequestConverter.buildSplitTableRegionRequest(regionInfo, splitRow, nonceGroup, nonce);
    while (keepLooping()) {
        RegionServerStatusService.BlockingInterface rss = rssStub;
        try {
            if (rss == null) {
                createRegionServerStatusStub();
                continue;
            }
            SplitTableRegionResponse response = rss.splitRegion(null, request);
            //TODO: should we limit the retry number before quitting?
            if (response == null || (procId = response.getProcId()) == -1) {
                LOG.warn("Failed to split " + regionInfo + " retrying...");
                continue;
            }
            break;
        } catch (ServiceException se) {
            // TODO: retry or just fail
            IOException ioe = ProtobufUtil.getRemoteException(se);
            LOG.info("Failed to split region, will retry", ioe);
            if (rssStub == rss) {
                rssStub = null;
            }
        }
    }
    return procId;
}
Also used : ServiceException(org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException) RegionServerStatusService(org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.RegionServerStatusService) SplitTableRegionRequest(org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.SplitTableRegionRequest) NonceGenerator(org.apache.hadoop.hbase.client.NonceGenerator) InterruptedIOException(java.io.InterruptedIOException) IOException(java.io.IOException) SplitTableRegionResponse(org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.SplitTableRegionResponse)

Aggregations

IOException (java.io.IOException)1 InterruptedIOException (java.io.InterruptedIOException)1 NonceGenerator (org.apache.hadoop.hbase.client.NonceGenerator)1 ServiceException (org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException)1 RegionServerStatusService (org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.RegionServerStatusService)1 SplitTableRegionRequest (org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.SplitTableRegionRequest)1 SplitTableRegionResponse (org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.SplitTableRegionResponse)1