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;
}
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;
}
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();
}
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();
}
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();
}
Aggregations