Search in sources :

Example 1 with BalancerDecisionDetails

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);
    }
}
Also used : RecentLogs(org.apache.hadoop.hbase.shaded.protobuf.generated.RecentLogs) BalancerDecision(org.apache.hadoop.hbase.client.BalancerDecision) BalancerDecisionDetails(org.apache.hadoop.hbase.namequeues.BalancerDecisionDetails) List(java.util.List)

Aggregations

List (java.util.List)1 BalancerDecision (org.apache.hadoop.hbase.client.BalancerDecision)1 BalancerDecisionDetails (org.apache.hadoop.hbase.namequeues.BalancerDecisionDetails)1 RecentLogs (org.apache.hadoop.hbase.shaded.protobuf.generated.RecentLogs)1