Search in sources :

Example 1 with RemoteProcedureResult

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

the class RemoteProcedureResultReporter method run.

@Override
public void run() {
    ReportProcedureDoneRequest.Builder builder = ReportProcedureDoneRequest.newBuilder();
    int tries = 0;
    while (!server.isStopped()) {
        if (builder.getResultCount() == 0) {
            try {
                builder.addResult(results.take());
            } catch (InterruptedException e) {
                Thread.currentThread().interrupt();
                continue;
            }
        }
        while (builder.getResultCount() < MAX_BATCH) {
            RemoteProcedureResult result = results.poll();
            if (result == null) {
                break;
            }
            builder.addResult(result);
        }
        ReportProcedureDoneRequest request = builder.build();
        try {
            server.reportProcedureDone(builder.build());
            builder.clear();
            tries = 0;
        } catch (IOException e) {
            boolean pause = e instanceof ServerNotRunningYetException || e instanceof PleaseHoldException;
            long pauseTime;
            if (pause) {
                // Do backoff else we flood the Master with requests.
                pauseTime = ConnectionUtils.getPauseTime(server.getRetryPauseTime(), tries);
            } else {
                // Reset.
                pauseTime = server.getRetryPauseTime();
            }
            LOG.info("Failed procedure report " + TextFormat.shortDebugString(request) + "; retry (#" + tries + ")" + (pause ? " after " + pauseTime + "ms delay (Master is coming online...)." : " immediately."), e);
            Threads.sleep(pauseTime);
            tries++;
        }
    }
}
Also used : PleaseHoldException(org.apache.hadoop.hbase.PleaseHoldException) ReportProcedureDoneRequest(org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.ReportProcedureDoneRequest) RemoteProcedureResult(org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.RemoteProcedureResult) IOException(java.io.IOException) ServerNotRunningYetException(org.apache.hadoop.hbase.ipc.ServerNotRunningYetException)

Aggregations

IOException (java.io.IOException)1 PleaseHoldException (org.apache.hadoop.hbase.PleaseHoldException)1 ServerNotRunningYetException (org.apache.hadoop.hbase.ipc.ServerNotRunningYetException)1 RemoteProcedureResult (org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.RemoteProcedureResult)1 ReportProcedureDoneRequest (org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.ReportProcedureDoneRequest)1