Search in sources :

Example 1 with IsProcedureDoneResponse

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

the class MasterRpcServices method isProcedureDone.

/**
   * Checks if the specified procedure is done.
   * @return true if the procedure is done, false if the procedure is in the process of completing
   * @throws ServiceException if invalid procedure or failed procedure with progress failure reason.
   */
@Override
public IsProcedureDoneResponse isProcedureDone(RpcController controller, IsProcedureDoneRequest request) throws ServiceException {
    try {
        master.checkInitialized();
        ProcedureDescription desc = request.getProcedure();
        MasterProcedureManager mpm = master.getMasterProcedureManagerHost().getProcedureManager(desc.getSignature());
        if (mpm == null) {
            throw new ServiceException("The procedure is not registered: " + desc.getSignature());
        }
        LOG.debug("Checking to see if procedure from request:" + desc.getSignature() + " is done");
        IsProcedureDoneResponse.Builder builder = IsProcedureDoneResponse.newBuilder();
        boolean done = mpm.isProcedureDone(desc);
        builder.setDone(done);
        return builder.build();
    } catch (ForeignException e) {
        throw new ServiceException(e.getCause());
    } catch (IOException e) {
        throw new ServiceException(e);
    }
}
Also used : ServiceException(org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException) ForeignException(org.apache.hadoop.hbase.errorhandling.ForeignException) ProcedureDescription(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ProcedureDescription) IsProcedureDoneResponse(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.IsProcedureDoneResponse) MasterProcedureManager(org.apache.hadoop.hbase.procedure.MasterProcedureManager) IOException(java.io.IOException) DoNotRetryIOException(org.apache.hadoop.hbase.DoNotRetryIOException)

Aggregations

IOException (java.io.IOException)1 DoNotRetryIOException (org.apache.hadoop.hbase.DoNotRetryIOException)1 ForeignException (org.apache.hadoop.hbase.errorhandling.ForeignException)1 MasterProcedureManager (org.apache.hadoop.hbase.procedure.MasterProcedureManager)1 ServiceException (org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException)1 ProcedureDescription (org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ProcedureDescription)1 IsProcedureDoneResponse (org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.IsProcedureDoneResponse)1