Search in sources :

Example 1 with GetRegionLoadResponse

use of org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.GetRegionLoadResponse in project hbase by apache.

the class RSRpcServices method getRegionLoad.

@Override
@QosPriority(priority = HConstants.ADMIN_QOS)
public GetRegionLoadResponse getRegionLoad(RpcController controller, GetRegionLoadRequest request) throws ServiceException {
    List<HRegion> regions;
    if (request.hasTableName()) {
        TableName tableName = ProtobufUtil.toTableName(request.getTableName());
        regions = server.getRegions(tableName);
    } else {
        regions = server.getRegions();
    }
    List<RegionLoad> rLoads = new ArrayList<>(regions.size());
    RegionLoad.Builder regionLoadBuilder = ClusterStatusProtos.RegionLoad.newBuilder();
    RegionSpecifier.Builder regionSpecifier = RegionSpecifier.newBuilder();
    try {
        for (HRegion region : regions) {
            rLoads.add(server.createRegionLoad(region, regionLoadBuilder, regionSpecifier));
        }
    } catch (IOException e) {
        throw new ServiceException(e);
    }
    GetRegionLoadResponse.Builder builder = GetRegionLoadResponse.newBuilder();
    builder.addAllRegionLoads(rLoads);
    return builder.build();
}
Also used : ArrayList(java.util.ArrayList) IOException(java.io.IOException) DoNotRetryIOException(org.apache.hadoop.hbase.DoNotRetryIOException) HBaseIOException(org.apache.hadoop.hbase.HBaseIOException) UncheckedIOException(java.io.UncheckedIOException) RegionSpecifier(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.RegionSpecifier) TableName(org.apache.hadoop.hbase.TableName) RegionLoad(org.apache.hadoop.hbase.shaded.protobuf.generated.ClusterStatusProtos.RegionLoad) ServiceException(org.apache.hbase.thirdparty.com.google.protobuf.ServiceException) GetRegionLoadResponse(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.GetRegionLoadResponse) QosPriority(org.apache.hadoop.hbase.ipc.QosPriority)

Example 2 with GetRegionLoadResponse

use of org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.GetRegionLoadResponse in project hbase by apache.

the class ProtobufUtil method getRegionLoad.

public static List<org.apache.hadoop.hbase.RegionLoad> getRegionLoad(final RpcController controller, final AdminService.BlockingInterface admin, final TableName tableName) throws IOException {
    GetRegionLoadRequest request = RequestConverter.buildGetRegionLoadRequest(tableName);
    GetRegionLoadResponse response;
    try {
        response = admin.getRegionLoad(controller, request);
    } catch (ServiceException se) {
        throw getRemoteException(se);
    }
    return getRegionLoadInfo(response);
}
Also used : ServiceException(org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException) GetRegionLoadResponse(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.GetRegionLoadResponse) GetRegionLoadRequest(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.GetRegionLoadRequest)

Aggregations

GetRegionLoadResponse (org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.GetRegionLoadResponse)2 IOException (java.io.IOException)1 UncheckedIOException (java.io.UncheckedIOException)1 ArrayList (java.util.ArrayList)1 DoNotRetryIOException (org.apache.hadoop.hbase.DoNotRetryIOException)1 HBaseIOException (org.apache.hadoop.hbase.HBaseIOException)1 TableName (org.apache.hadoop.hbase.TableName)1 QosPriority (org.apache.hadoop.hbase.ipc.QosPriority)1 ServiceException (org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException)1 GetRegionLoadRequest (org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.GetRegionLoadRequest)1 RegionLoad (org.apache.hadoop.hbase.shaded.protobuf.generated.ClusterStatusProtos.RegionLoad)1 RegionSpecifier (org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.RegionSpecifier)1 ServiceException (org.apache.hbase.thirdparty.com.google.protobuf.ServiceException)1