gianm closed pull request #6032: Fix coordinator balancer 'moved' logs and 
metrics
URL: https://github.com/apache/incubator-druid/pull/6032
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/server/src/main/java/io/druid/server/coordinator/helper/DruidCoordinatorBalancer.java
 
b/server/src/main/java/io/druid/server/coordinator/helper/DruidCoordinatorBalancer.java
index 8547954f3d4..b4db2a9fa3d 100644
--- 
a/server/src/main/java/io/druid/server/coordinator/helper/DruidCoordinatorBalancer.java
+++ 
b/server/src/main/java/io/druid/server/coordinator/helper/DruidCoordinatorBalancer.java
@@ -129,9 +129,9 @@ private void balanceTier(
     final int maxSegmentsToMove = 
Math.min(params.getCoordinatorDynamicConfig().getMaxSegmentsToMove(), 
numSegments);
     final int maxIterations = 2 * maxSegmentsToMove;
     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);
 
       if (segmentToMoveHolder != null && 
params.getAvailableSegments().contains(segmentToMoveHolder.getSegment())) {
@@ -179,14 +179,14 @@ private void balanceTier(
       log.info("No good moves found in tier [%s]", tier);
     }
     stats.addToTieredStat("unmovedCount", tier, unmoved);
-    stats.addToTieredStat("movedCount", tier, 
currentlyMovingSegments.get(tier).size());
+    stats.addToTieredStat("movedCount", tier, moved);
     if (params.getCoordinatorDynamicConfig().emitBalancingStats()) {
       strategy.emitStats(tier, stats, toMoveFrom);
     }
     log.info(
         "[%s]: Segments Moved: [%d] Segments Let Alone: [%d]",
         tier,
-        currentlyMovingSegments.get(tier).size(),
+        moved,
         unmoved
     );
   }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to