Skip to content

Commit 3df5904

Browse files
overload addBalancerRoundSummary
1 parent e99d3b9 commit 3df5904

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

server/src/main/java/org/elasticsearch/cluster/routing/allocation/allocator/AllocationBalancingRoundSummaryService.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,15 @@ private static Map<String, BalancingRoundSummary.NodesWeightsChanges> createWeig
144144
return nodeNameToWeightInfo;
145145
}
146146

147+
/**
148+
* Creates and saves a balancer round summary for the work to move from {@code oldDesiredBalance} to {@code newDesiredBalance}. If
149+
* balancer round summaries are not enabled in the cluster (see {@link #ENABLE_BALANCER_ROUND_SUMMARIES_SETTING}), then the summary is
150+
* immediately discarded.
151+
*/
152+
public void addBalancerRoundSummary(DesiredBalance oldDesiredBalance, DesiredBalance newDesiredBalance) {
153+
addBalancerRoundSummary(createBalancerRoundSummary(oldDesiredBalance, newDesiredBalance));
154+
}
155+
147156
/**
148157
* Adds the summary of a balancing round. If summaries are enabled, this will eventually be reported (logging, etc.). If balancer round
149158
* summaries are not enabled in the cluster, then the summary is immediately discarded (so as not to fill up a data structure that will

server/src/main/java/org/elasticsearch/cluster/routing/allocation/allocator/DesiredBalanceShardsAllocator.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -324,9 +324,7 @@ private void setCurrentDesiredBalance(DesiredBalance newDesiredBalance) {
324324
}
325325

326326
if (currentDesiredBalanceRef.compareAndSet(oldDesiredBalance, newDesiredBalance)) {
327-
balancerRoundSummaryService.addBalancerRoundSummary(
328-
AllocationBalancingRoundSummaryService.createBalancerRoundSummary(oldDesiredBalance, newDesiredBalance)
329-
);
327+
balancerRoundSummaryService.addBalancerRoundSummary(oldDesiredBalance, newDesiredBalance);
330328
if (logger.isTraceEnabled()) {
331329
var diff = DesiredBalance.hasChanges(oldDesiredBalance, newDesiredBalance)
332330
? "Diff: " + DesiredBalance.humanReadableDiff(oldDesiredBalance, newDesiredBalance)

0 commit comments

Comments
 (0)