Skip to content

Commit

Permalink
improvements per review
Browse files Browse the repository at this point in the history
  • Loading branch information
DiannaHohensee committed Jan 10, 2025
1 parent ebb5528 commit 9507d31
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* The desired balance of the cluster, indicating which nodes should hold a copy of each shard.
*
* @param lastConvergedIndex Identifies what input data the balancer computation round used to produce this {@link DesiredBalance}. See
* {@link DesiredBalanceInput#index()} for details. Each reroute request gets assigned a monotonically increasing
* {@link DesiredBalanceInput#index()} for details. Each reroute request gets assigned a strictly increasing
* sequence number, and the balancer, which runs async to reroute, uses the latest request's data to compute the
* desired balance.
* @param assignments a set of the (persistent) node IDs to which each {@link ShardId} should be allocated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ public DesiredBalanceReconciler(
this.nodeAllocationStatsAndWeightsCalculator = nodeAllocationStatsAndWeightsCalculator;
}

/**
* Applies a desired shard allocation to the routing table by initializing and relocating shards in the cluster state.
*
* @param desiredBalance The new desired cluster shard allocation
* @param allocation Cluster state information with which to make decisions, contains routing table metadata that will be modified to
* reach the given desired balance.
*/
public void reconcile(DesiredBalance desiredBalance, RoutingAllocation allocation) {
var nodeIds = allocation.routingNodes().getAllNodeIds();
allocationOrdering.retainNodes(nodeIds);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ public class DesiredBalanceShardsAllocator implements ShardsAllocator {
private final DesiredBalanceReconciler desiredBalanceReconciler;
private final ContinuousComputation<DesiredBalanceInput> desiredBalanceComputation;
/**
* Accepts listeners with an index value (see {#link #indexGenerator}) and run them whenever a DesiredBalance computation completes with
* an equal or greater index value.
* Saves and runs listeners after DesiredBalance computations complete.
*/
private final PendingListenersQueue pendingListenersQueue;
/**
Expand Down

0 comments on commit 9507d31

Please sign in to comment.