mirror of https://github.com/apache/druid.git
use existing currentlyMovingSegments instead of creating a reundant segmentsBeingMoved
This commit is contained in:
parent
034d652569
commit
b205f7b3c4
|
@ -116,15 +116,13 @@ public class DruidMasterBalancer implements DruidMasterHelper
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Set<DataSegment> segmentsBeingMoved = new HashSet<DataSegment>();
|
|
||||||
int iter = 0;
|
int iter = 0;
|
||||||
|
|
||||||
while (iter < maxSegmentsToMove) {
|
while (iter < maxSegmentsToMove) {
|
||||||
BalancerSegmentHolder segmentToMove = analyzer.pickSegmentToMove(serverHolderList, numSegments);
|
BalancerSegmentHolder segmentToMove = analyzer.pickSegmentToMove(serverHolderList, numSegments);
|
||||||
DruidServer toServer = analyzer.findNewSegmentHome(segmentToMove.getSegment(), serverHolderList).getServer();
|
DruidServer toServer = analyzer.findNewSegmentHome(segmentToMove.getSegment(), serverHolderList).getServer();
|
||||||
if (!segmentsBeingMoved.contains(segmentToMove.getSegment())) {
|
if (!currentlyMovingSegments.get(tier).containsKey(segmentToMove.getSegment())) {
|
||||||
moveSegment(segmentToMove, toServer, params);
|
moveSegment(segmentToMove, toServer, params);
|
||||||
segmentsBeingMoved.add(segmentToMove.getSegment());
|
|
||||||
}
|
}
|
||||||
iter++;
|
iter++;
|
||||||
}
|
}
|
||||||
|
@ -135,13 +133,13 @@ public class DruidMasterBalancer implements DruidMasterHelper
|
||||||
|
|
||||||
stats.addToTieredStat("initialCost", tier, (long) initialTotalCost);
|
stats.addToTieredStat("initialCost", tier, (long) initialTotalCost);
|
||||||
stats.addToTieredStat("normalization", tier, (long) normalization);
|
stats.addToTieredStat("normalization", tier, (long) normalization);
|
||||||
stats.addToTieredStat("movedCount", tier, segmentsBeingMoved.size());
|
stats.addToTieredStat("movedCount", tier, currentlyMovingSegments.get(tier).size());
|
||||||
|
|
||||||
log.info(
|
log.info(
|
||||||
"Initial Total Cost: [%f], Initial Normalized Cost: [%f], Segments Moved: [%d]",
|
"Initial Total Cost: [%f], Initial Normalized Cost: [%f], Segments Moved: [%d]",
|
||||||
initialTotalCost,
|
initialTotalCost,
|
||||||
normalizedInitialCost,
|
normalizedInitialCost,
|
||||||
segmentsBeingMoved.size()
|
currentlyMovingSegments.get(tier).size()
|
||||||
);
|
);
|
||||||
|
|
||||||
if (serverHolderList.size() <= 1) {
|
if (serverHolderList.size() <= 1) {
|
||||||
|
|
Loading…
Reference in New Issue