Search in sources :

Example 1 with GetSchemaAlterStatusResponse

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

the class MasterRpcServices method getSchemaAlterStatus.

/**
 * Get the number of regions of the table that have been updated by the alter.
 *
 * @return Pair indicating the number of regions updated Pair.getFirst is the
 *         regions that are yet to be updated Pair.getSecond is the total number
 *         of regions of the table
 * @throws ServiceException
 */
@Override
public GetSchemaAlterStatusResponse getSchemaAlterStatus(RpcController controller, GetSchemaAlterStatusRequest req) throws ServiceException {
    // TODO: currently, we query using the table name on the client side. this
    // may overlap with other table operations or the table operation may
    // have completed before querying this API. We need to refactor to a
    // transaction system in the future to avoid these ambiguities.
    TableName tableName = ProtobufUtil.toTableName(req.getTableName());
    try {
        server.checkInitialized();
        Pair<Integer, Integer> pair = server.getAssignmentManager().getReopenStatus(tableName);
        GetSchemaAlterStatusResponse.Builder ret = GetSchemaAlterStatusResponse.newBuilder();
        ret.setYetToUpdateRegions(pair.getFirst());
        ret.setTotalRegions(pair.getSecond());
        return ret.build();
    } catch (IOException ioe) {
        throw new ServiceException(ioe);
    }
}
Also used : TableName(org.apache.hadoop.hbase.TableName) ServiceException(org.apache.hbase.thirdparty.com.google.protobuf.ServiceException) IOException(java.io.IOException) DoNotRetryIOException(org.apache.hadoop.hbase.DoNotRetryIOException) GetSchemaAlterStatusResponse(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.GetSchemaAlterStatusResponse)

Aggregations

IOException (java.io.IOException)1 DoNotRetryIOException (org.apache.hadoop.hbase.DoNotRetryIOException)1 TableName (org.apache.hadoop.hbase.TableName)1 GetSchemaAlterStatusResponse (org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.GetSchemaAlterStatusResponse)1 ServiceException (org.apache.hbase.thirdparty.com.google.protobuf.ServiceException)1