Search in sources :

Example 1 with GetRSGroupInfoOfTableResponse

use of org.apache.hadoop.hbase.shaded.protobuf.generated.RSGroupAdminProtos.GetRSGroupInfoOfTableResponse in project hbase by apache.

the class MasterRpcServices method getRSGroupInfoOfTable.

@Override
public GetRSGroupInfoOfTableResponse getRSGroupInfoOfTable(RpcController controller, GetRSGroupInfoOfTableRequest request) throws ServiceException {
    TableName tableName = ProtobufUtil.toTableName(request.getTableName());
    LOG.info(server.getClientIdAuditPrefix() + " initiates rsgroup info retrieval, table=" + tableName);
    try {
        if (server.getMasterCoprocessorHost() != null) {
            server.getMasterCoprocessorHost().preGetRSGroupInfoOfTable(tableName);
        }
        GetRSGroupInfoOfTableResponse resp;
        TableDescriptor td = server.getTableDescriptors().get(tableName);
        if (td == null) {
            resp = GetRSGroupInfoOfTableResponse.getDefaultInstance();
        } else {
            RSGroupInfo rsGroupInfo = RSGroupUtil.getRSGroupInfo(server, server.getRSGroupInfoManager(), tableName).orElse(server.getRSGroupInfoManager().getRSGroup(RSGroupInfo.DEFAULT_GROUP));
            resp = GetRSGroupInfoOfTableResponse.newBuilder().setRSGroupInfo(ProtobufUtil.toProtoGroupInfo(rsGroupInfo)).build();
        }
        if (server.getMasterCoprocessorHost() != null) {
            server.getMasterCoprocessorHost().postGetRSGroupInfoOfTable(tableName);
        }
        return resp;
    } catch (IOException e) {
        throw new ServiceException(e);
    }
}
Also used : TableName(org.apache.hadoop.hbase.TableName) GetRSGroupInfoOfTableResponse(org.apache.hadoop.hbase.shaded.protobuf.generated.RSGroupAdminProtos.GetRSGroupInfoOfTableResponse) ServiceException(org.apache.hbase.thirdparty.com.google.protobuf.ServiceException) RSGroupInfo(org.apache.hadoop.hbase.rsgroup.RSGroupInfo) IOException(java.io.IOException) DoNotRetryIOException(org.apache.hadoop.hbase.DoNotRetryIOException) TableDescriptor(org.apache.hadoop.hbase.client.TableDescriptor)

Example 2 with GetRSGroupInfoOfTableResponse

use of org.apache.hadoop.hbase.shaded.protobuf.generated.RSGroupAdminProtos.GetRSGroupInfoOfTableResponse in project hbase by apache.

the class RSGroupAdminServiceImpl method getRSGroupInfoOfTable.

@Override
public void getRSGroupInfoOfTable(RpcController controller, GetRSGroupInfoOfTableRequest request, RpcCallback<GetRSGroupInfoOfTableResponse> done) {
    GetRSGroupInfoOfTableResponse.Builder builder = GetRSGroupInfoOfTableResponse.newBuilder();
    TableName tableName = ProtobufUtil.toTableName(request.getTableName());
    LOG.info(master.getClientIdAuditPrefix() + " initiates rsgroup info retrieval, table=" + tableName);
    try {
        if (master.getMasterCoprocessorHost() != null) {
            master.getMasterCoprocessorHost().preGetRSGroupInfoOfTable(tableName);
        }
        Optional<RSGroupInfo> optGroup = RSGroupUtil.getRSGroupInfo(master, rsGroupInfoManager, tableName);
        if (optGroup.isPresent()) {
            builder.setRSGroupInfo(ProtobufUtil.toProtoGroupInfo(fillTables(optGroup.get())));
        } else {
            if (master.getTableStateManager().isTablePresent(tableName)) {
                RSGroupInfo rsGroupInfo = rsGroupInfoManager.getRSGroup(RSGroupInfo.DEFAULT_GROUP);
                builder.setRSGroupInfo(ProtobufUtil.toProtoGroupInfo(fillTables(rsGroupInfo)));
            }
        }
        if (master.getMasterCoprocessorHost() != null) {
            master.getMasterCoprocessorHost().postGetRSGroupInfoOfTable(tableName);
        }
    } catch (IOException e) {
        CoprocessorRpcUtils.setControllerException(controller, e);
    }
    done.run(builder.build());
}
Also used : TableName(org.apache.hadoop.hbase.TableName) GetRSGroupInfoOfTableResponse(org.apache.hadoop.hbase.shaded.protobuf.generated.RSGroupAdminProtos.GetRSGroupInfoOfTableResponse) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)2 TableName (org.apache.hadoop.hbase.TableName)2 GetRSGroupInfoOfTableResponse (org.apache.hadoop.hbase.shaded.protobuf.generated.RSGroupAdminProtos.GetRSGroupInfoOfTableResponse)2 DoNotRetryIOException (org.apache.hadoop.hbase.DoNotRetryIOException)1 TableDescriptor (org.apache.hadoop.hbase.client.TableDescriptor)1 RSGroupInfo (org.apache.hadoop.hbase.rsgroup.RSGroupInfo)1 ServiceException (org.apache.hbase.thirdparty.com.google.protobuf.ServiceException)1