log correct moved count on balance instead of snapshot of currently moving (#6032)

This commit is contained in:
Clint Wylie 2018-08-01 03:36:10 -07:00 committed by Gian Merlino
parent 0754d78a2e
commit 297810e7a4
1 changed files with 4 additions and 4 deletions

View File

@ -129,9 +129,9 @@ public class DruidCoordinatorBalancer implements DruidCoordinatorHelper
final int maxSegmentsToMove = Math.min(params.getCoordinatorDynamicConfig().getMaxSegmentsToMove(), numSegments); final int maxSegmentsToMove = Math.min(params.getCoordinatorDynamicConfig().getMaxSegmentsToMove(), numSegments);
final int maxIterations = 2 * maxSegmentsToMove; final int maxIterations = 2 * maxSegmentsToMove;
final int maxToLoad = params.getCoordinatorDynamicConfig().getMaxSegmentsInNodeLoadingQueue(); final int maxToLoad = params.getCoordinatorDynamicConfig().getMaxSegmentsInNodeLoadingQueue();
long unmoved = 0L; int moved = 0, unmoved = 0;
for (int moved = 0, iter = 0; (moved + unmoved) < maxSegmentsToMove; ++iter) { for (int iter = 0; (moved + unmoved) < maxSegmentsToMove; ++iter) {
final BalancerSegmentHolder segmentToMoveHolder = strategy.pickSegmentToMove(toMoveFrom); final BalancerSegmentHolder segmentToMoveHolder = strategy.pickSegmentToMove(toMoveFrom);
if (segmentToMoveHolder != null && params.getAvailableSegments().contains(segmentToMoveHolder.getSegment())) { if (segmentToMoveHolder != null && params.getAvailableSegments().contains(segmentToMoveHolder.getSegment())) {
@ -179,14 +179,14 @@ public class DruidCoordinatorBalancer implements DruidCoordinatorHelper
log.info("No good moves found in tier [%s]", tier); log.info("No good moves found in tier [%s]", tier);
} }
stats.addToTieredStat("unmovedCount", tier, unmoved); stats.addToTieredStat("unmovedCount", tier, unmoved);
stats.addToTieredStat("movedCount", tier, currentlyMovingSegments.get(tier).size()); stats.addToTieredStat("movedCount", tier, moved);
if (params.getCoordinatorDynamicConfig().emitBalancingStats()) { if (params.getCoordinatorDynamicConfig().emitBalancingStats()) {
strategy.emitStats(tier, stats, toMoveFrom); strategy.emitStats(tier, stats, toMoveFrom);
} }
log.info( log.info(
"[%s]: Segments Moved: [%d] Segments Let Alone: [%d]", "[%s]: Segments Moved: [%d] Segments Let Alone: [%d]",
tier, tier,
currentlyMovingSegments.get(tier).size(), moved,
unmoved unmoved
); );
} }