Skip to content

Skip rebalancing for single node per partition #128167

Merged
ywangd merged 2 commits intoelastic:mainfrom
ywangd:skip-single-ndoe-per-partition
May 20, 2025
Merged

Skip rebalancing for single node per partition #128167
ywangd merged 2 commits intoelastic:mainfrom
ywangd:skip-single-ndoe-per-partition

Conversation

@ywangd
Copy link
Member

@ywangd ywangd commented May 20, 2025

If the cluster has 2 nodes in total and 1 node in each partition, rebalancing can be skipped when it runs per partition.

Relates: #126091

ywangd added 2 commits May 15, 2025 02:03
If the cluster has 2 nodes and 1 in each partition. Rebalancing can be
skipped when it runs per partition.
@ywangd ywangd requested a review from nicktindall May 20, 2025 00:50
@ywangd ywangd added >non-issue :Distributed/Allocation All issues relating to the decision making around placing a shard (both master logic & on the nodes) v9.1.0 labels May 20, 2025
@elasticsearchmachine elasticsearchmachine added the Team:Distributed Coordination (obsolete) Meta label for Distributed Coordination team. Obsolete. Please do not use. label May 20, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-distributed-coordination (Team:Distributed Coordination)

Comment on lines +383 to +386
if (nodeSorter.modelNodes.length < 2) { /* skip if we only have one node */
logger.trace("skipping rebalance as the partition has single node only");
continue;
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change means we can skip rebalancing for one partition but not the other. I think that's OK. But please let me know if there are subtle connections between the two balancing rounds and must run in tandem.

Copy link
Contributor

@nicktindall nicktindall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, this seems like a sensible place to put that logic after the change. Thanks!

@ywangd ywangd merged commit 3594ade into elastic:main May 20, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Distributed/Allocation All issues relating to the decision making around placing a shard (both master logic & on the nodes) >non-issue Team:Distributed Coordination (obsolete) Meta label for Distributed Coordination team. Obsolete. Please do not use. v9.1.0

3 participants