Search in sources :

Example 6 with NamedQueueGetResponse

use of org.apache.hadoop.hbase.namequeues.response.NamedQueueGetResponse in project hbase by apache.

the class HBaseRpcServicesBase method getSlowLogPayloads.

private List<SlowLogPayload> getSlowLogPayloads(SlowLogResponseRequest request, NamedQueueRecorder namedQueueRecorder) {
    if (namedQueueRecorder == null) {
        return Collections.emptyList();
    }
    List<SlowLogPayload> slowLogPayloads;
    NamedQueueGetRequest namedQueueGetRequest = new NamedQueueGetRequest();
    namedQueueGetRequest.setNamedQueueEvent(RpcLogDetails.SLOW_LOG_EVENT);
    namedQueueGetRequest.setSlowLogResponseRequest(request);
    NamedQueueGetResponse namedQueueGetResponse = namedQueueRecorder.getNamedQueueRecords(namedQueueGetRequest);
    slowLogPayloads = namedQueueGetResponse != null ? namedQueueGetResponse.getSlowLogPayloads() : Collections.emptyList();
    return slowLogPayloads;
}
Also used : SlowLogPayload(org.apache.hadoop.hbase.shaded.protobuf.generated.TooSlowLog.SlowLogPayload) NamedQueueGetResponse(org.apache.hadoop.hbase.namequeues.response.NamedQueueGetResponse) NamedQueueGetRequest(org.apache.hadoop.hbase.namequeues.request.NamedQueueGetRequest)

Example 7 with NamedQueueGetResponse

use of org.apache.hadoop.hbase.namequeues.response.NamedQueueGetResponse in project hbase by apache.

the class BalancerRejectionQueueService method getNamedQueueRecords.

@Override
public NamedQueueGetResponse getNamedQueueRecords(NamedQueueGetRequest request) {
    if (!isBalancerRejectionRecording) {
        return null;
    }
    List<RecentLogs.BalancerRejection> balancerRejections = Arrays.stream(balancerRejectionQueue.toArray(new RecentLogs.BalancerRejection[0])).collect(Collectors.toList());
    // latest records should be displayed first, hence reverse order sorting
    Collections.reverse(balancerRejections);
    int limit = balancerRejections.size();
    if (request.getBalancerRejectionsRequest().hasLimit()) {
        limit = Math.min(request.getBalancerRejectionsRequest().getLimit(), balancerRejections.size());
    }
    // filter limit if provided
    balancerRejections = balancerRejections.subList(0, limit);
    final NamedQueueGetResponse namedQueueGetResponse = new NamedQueueGetResponse();
    namedQueueGetResponse.setNamedQueueEvent(BalancerRejectionDetails.BALANCER_REJECTION_EVENT);
    namedQueueGetResponse.setBalancerRejections(balancerRejections);
    return namedQueueGetResponse;
}
Also used : BalancerRejection(org.apache.hadoop.hbase.client.BalancerRejection) RecentLogs(org.apache.hadoop.hbase.shaded.protobuf.generated.RecentLogs) NamedQueueGetResponse(org.apache.hadoop.hbase.namequeues.response.NamedQueueGetResponse)

Example 8 with NamedQueueGetResponse

use of org.apache.hadoop.hbase.namequeues.response.NamedQueueGetResponse in project hbase by apache.

the class MasterRpcServices method getBalancerDecisions.

private MasterProtos.BalancerDecisionsResponse getBalancerDecisions(MasterProtos.BalancerDecisionsRequest request) {
    final NamedQueueRecorder namedQueueRecorder = this.server.getNamedQueueRecorder();
    if (namedQueueRecorder == null) {
        return MasterProtos.BalancerDecisionsResponse.newBuilder().addAllBalancerDecision(Collections.emptyList()).build();
    }
    final NamedQueueGetRequest namedQueueGetRequest = new NamedQueueGetRequest();
    namedQueueGetRequest.setNamedQueueEvent(BalancerDecisionDetails.BALANCER_DECISION_EVENT);
    namedQueueGetRequest.setBalancerDecisionsRequest(request);
    NamedQueueGetResponse namedQueueGetResponse = namedQueueRecorder.getNamedQueueRecords(namedQueueGetRequest);
    List<RecentLogs.BalancerDecision> balancerDecisions = namedQueueGetResponse != null ? namedQueueGetResponse.getBalancerDecisions() : Collections.emptyList();
    return MasterProtos.BalancerDecisionsResponse.newBuilder().addAllBalancerDecision(balancerDecisions).build();
}
Also used : NamedQueueRecorder(org.apache.hadoop.hbase.namequeues.NamedQueueRecorder) NamedQueueGetResponse(org.apache.hadoop.hbase.namequeues.response.NamedQueueGetResponse) NamedQueueGetRequest(org.apache.hadoop.hbase.namequeues.request.NamedQueueGetRequest)

Example 9 with NamedQueueGetResponse

use of org.apache.hadoop.hbase.namequeues.response.NamedQueueGetResponse in project hbase by apache.

the class MasterRpcServices method getBalancerRejections.

private MasterProtos.BalancerRejectionsResponse getBalancerRejections(MasterProtos.BalancerRejectionsRequest request) {
    final NamedQueueRecorder namedQueueRecorder = this.server.getNamedQueueRecorder();
    if (namedQueueRecorder == null) {
        return MasterProtos.BalancerRejectionsResponse.newBuilder().addAllBalancerRejection(Collections.emptyList()).build();
    }
    final NamedQueueGetRequest namedQueueGetRequest = new NamedQueueGetRequest();
    namedQueueGetRequest.setNamedQueueEvent(BalancerRejectionDetails.BALANCER_REJECTION_EVENT);
    namedQueueGetRequest.setBalancerRejectionsRequest(request);
    NamedQueueGetResponse namedQueueGetResponse = namedQueueRecorder.getNamedQueueRecords(namedQueueGetRequest);
    List<RecentLogs.BalancerRejection> balancerRejections = namedQueueGetResponse != null ? namedQueueGetResponse.getBalancerRejections() : Collections.emptyList();
    return MasterProtos.BalancerRejectionsResponse.newBuilder().addAllBalancerRejection(balancerRejections).build();
}
Also used : NamedQueueRecorder(org.apache.hadoop.hbase.namequeues.NamedQueueRecorder) NamedQueueGetResponse(org.apache.hadoop.hbase.namequeues.response.NamedQueueGetResponse) NamedQueueGetRequest(org.apache.hadoop.hbase.namequeues.request.NamedQueueGetRequest)

Example 10 with NamedQueueGetResponse

use of org.apache.hadoop.hbase.namequeues.response.NamedQueueGetResponse in project hbase by apache.

the class TestNamedQueueRecorder method getSlowLogPayloads.

private List<SlowLogPayload> getSlowLogPayloads(AdminProtos.SlowLogResponseRequest request) {
    NamedQueueGetRequest namedQueueGetRequest = new NamedQueueGetRequest();
    namedQueueGetRequest.setNamedQueueEvent(RpcLogDetails.SLOW_LOG_EVENT);
    namedQueueGetRequest.setSlowLogResponseRequest(request);
    NamedQueueGetResponse namedQueueGetResponse = namedQueueRecorder.getNamedQueueRecords(namedQueueGetRequest);
    return namedQueueGetResponse == null ? Collections.emptyList() : namedQueueGetResponse.getSlowLogPayloads();
}
Also used : NamedQueueGetResponse(org.apache.hadoop.hbase.namequeues.response.NamedQueueGetResponse) NamedQueueGetRequest(org.apache.hadoop.hbase.namequeues.request.NamedQueueGetRequest)

Aggregations

NamedQueueGetResponse (org.apache.hadoop.hbase.namequeues.response.NamedQueueGetResponse)10 NamedQueueGetRequest (org.apache.hadoop.hbase.namequeues.request.NamedQueueGetRequest)7 LogEntry (org.apache.hadoop.hbase.client.LogEntry)2 NamedQueueRecorder (org.apache.hadoop.hbase.namequeues.NamedQueueRecorder)2 MasterProtos (org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos)2 RecentLogs (org.apache.hadoop.hbase.shaded.protobuf.generated.RecentLogs)2 List (java.util.List)1 Map (java.util.Map)1 ServerName (org.apache.hadoop.hbase.ServerName)1 TableName (org.apache.hadoop.hbase.TableName)1 BalancerDecision (org.apache.hadoop.hbase.client.BalancerDecision)1 BalancerRejection (org.apache.hadoop.hbase.client.BalancerRejection)1 RegionInfo (org.apache.hadoop.hbase.client.RegionInfo)1 MasterServices (org.apache.hadoop.hbase.master.MasterServices)1 RegionPlan (org.apache.hadoop.hbase.master.RegionPlan)1 AdminProtos (org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos)1 SlowLogPayload (org.apache.hadoop.hbase.shaded.protobuf.generated.TooSlowLog.SlowLogPayload)1 Test (org.junit.Test)1