Skip to content

Commit

Permalink
add comment about set after no-longer-master
Browse files Browse the repository at this point in the history
  • Loading branch information
ywangd committed Nov 19, 2024
1 parent 708b510 commit bee0d1b
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ protected void processInput(DesiredBalanceInput desiredBalanceInput) {

recordTime(
cumulativeComputationTime,
// We set currentDesiredBalance back to INITIAL when the node stands down as master in onNoLongerMaster.
// However, it is possible that we revert the effect here by setting it again since the computation is async
// and does not check whether the node is master. This should have little to no practical impact. But it may
// lead to unexpected behaviours for tests. See also https://github.com/elastic/elasticsearch/pull/116904
() -> setCurrentDesiredBalance(
desiredBalanceComputer.compute(
getInitialDesiredBalance(),
Expand Down Expand Up @@ -214,7 +218,7 @@ public void allocate(RoutingAllocation allocation, ActionListener<Void> listener
desiredBalanceComputation.onNewInput(DesiredBalanceInput.create(index, allocation));

if (allocation.routingTable().indicesRouting().isEmpty()) {
logger.debug("No reconciliation needed for empty routing table");
logger.debug("No eager reconciliation needed for empty routing table");
return;
}
// Starts reconciliation towards desired balance that might have not been updated with a recent calculation yet.
Expand Down

0 comments on commit bee0d1b

Please sign in to comment.