use of org.apache.hadoop.hbase.namequeues.BalancerDecisionDetails in project hbase by apache.
the class BalancerDecisionQueueService method consumeEventFromDisruptor.
@Override
public void consumeEventFromDisruptor(NamedQueuePayload namedQueuePayload) {
if (!isBalancerDecisionRecording) {
return;
}
if (!(namedQueuePayload instanceof BalancerDecisionDetails)) {
LOG.warn("BalancerDecisionQueueService: NamedQueuePayload is not of type BalancerDecisionDetails.");
return;
}
BalancerDecisionDetails balancerDecisionDetails = (BalancerDecisionDetails) namedQueuePayload;
BalancerDecision balancerDecisionRecords = balancerDecisionDetails.getBalancerDecision();
List<String> regionPlans = balancerDecisionRecords.getRegionPlans();
List<List<String>> regionPlansList;
if (regionPlans.size() > REGION_PLANS_THRESHOLD_PER_BALANCER) {
regionPlansList = Lists.partition(regionPlans, REGION_PLANS_THRESHOLD_PER_BALANCER);
} else {
regionPlansList = Collections.singletonList(regionPlans);
}
for (List<String> regionPlansPerBalancer : regionPlansList) {
RecentLogs.BalancerDecision balancerDecision = RecentLogs.BalancerDecision.newBuilder().setInitTotalCost(balancerDecisionRecords.getInitTotalCost()).setInitialFunctionCosts(balancerDecisionRecords.getInitialFunctionCosts()).setComputedTotalCost(balancerDecisionRecords.getComputedTotalCost()).setFinalFunctionCosts(balancerDecisionRecords.getFinalFunctionCosts()).setComputedSteps(balancerDecisionRecords.getComputedSteps()).addAllRegionPlans(regionPlansPerBalancer).build();
balancerDecisionQueue.add(balancerDecision);
}
}
Aggregations