Skip to content

Commit 6f41c89

Browse files
committed
Only publish when node is master AND we have done a reconciliation
1 parent 89eee2c commit 6f41c89

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,15 +399,15 @@ private List<LongWithAttributes> getUndesiredAllocationsExcludingShuttingDownNod
399399

400400
private List<LongWithAttributes> getIfPublishing(ToLongFunction<AllocationStats> value) {
401401
var currentStats = lastReconciliationAllocationStats;
402-
if (currentStats != EMPTY_ALLOCATION_STATS) {
402+
if (nodeIsMaster && currentStats != EMPTY_ALLOCATION_STATS) {
403403
return List.of(new LongWithAttributes(value.applyAsLong(currentStats)));
404404
}
405405
return List.of();
406406
}
407407

408408
private List<DoubleWithAttributes> getUndesiredAllocationsRatioMetrics() {
409409
var currentStats = lastReconciliationAllocationStats;
410-
if (currentStats != EMPTY_ALLOCATION_STATS) {
410+
if (nodeIsMaster && currentStats != EMPTY_ALLOCATION_STATS) {
411411
return List.of(new DoubleWithAttributes(currentStats.undesiredAllocationsRatio()));
412412
}
413413
return List.of();

0 commit comments

Comments
 (0)