Search in sources :

Example 1 with RegionLoad

use of org.apache.hadoop.hbase.shaded.protobuf.generated.ClusterStatusProtos.RegionLoad 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<Region> regions;
    if (request.hasTableName()) {
        TableName tableName = ProtobufUtil.toTableName(request.getTableName());
        regions = regionServer.getOnlineRegions(tableName);
    } else {
        regions = regionServer.getOnlineRegions();
    }
    List<RegionLoad> rLoads = new ArrayList<>(regions.size());
    RegionLoad.Builder regionLoadBuilder = ClusterStatusProtos.RegionLoad.newBuilder();
    RegionSpecifier.Builder regionSpecifier = RegionSpecifier.newBuilder();
    try {
        for (Region region : regions) {
            rLoads.add(regionServer.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) InterruptedIOException(java.io.InterruptedIOException) IOException(java.io.IOException) DoNotRetryIOException(org.apache.hadoop.hbase.DoNotRetryIOException) HBaseIOException(org.apache.hadoop.hbase.HBaseIOException) 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.hadoop.hbase.shaded.com.google.protobuf.ServiceException) GetRegionLoadResponse(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.GetRegionLoadResponse) QosPriority(org.apache.hadoop.hbase.ipc.QosPriority)

Aggregations

IOException (java.io.IOException)1 InterruptedIOException (java.io.InterruptedIOException)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 GetRegionLoadResponse (org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.GetRegionLoadResponse)1 RegionLoad (org.apache.hadoop.hbase.shaded.protobuf.generated.ClusterStatusProtos.RegionLoad)1 RegionSpecifier (org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.RegionSpecifier)1