Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] RemoteShardsBalancer cannot rebalance shards as expected #15302

Open
bugmakerrrrrr opened this issue Aug 19, 2024 · 1 comment · May be fixed by #15335
Open

[BUG] RemoteShardsBalancer cannot rebalance shards as expected #15302

bugmakerrrrrr opened this issue Aug 19, 2024 · 1 comment · May be fixed by #15335
Assignees
Labels
bug Something isn't working Search:Searchable Snapshots

Comments

@bugmakerrrrrr
Copy link
Contributor

Describe the bug

When rebalancing searchable snapshot indices, we first calculate the average number of primary shards that each node should has. In current implementation, the formula is as follows.

(totalNumberOfRemotePrimaryShards + totalNumberOfUnassignedShards)/totalNumberOfRoutingNodes

final Map<String, Integer> nodePrimaryShardCount = calculateNodePrimaryShardCount(remoteRoutingNodes);
int totalPrimaryShardCount = nodePrimaryShardCount.values().stream().reduce(0, Integer::sum);
totalPrimaryShardCount += routingNodes.unassigned().getNumPrimaries();
int avgPrimaryPerNode = (totalPrimaryShardCount + routingNodes.size() - 1) / routingNodes.size();

If a cluster has both search nodes and dedicated data nodes, this average number of shards calculated using the current formula may be lower than the actual number.. I think that the formula needs to be adjusted as follows:

(totalNumberOfRemotePrimaryShards + totalNumberOfUnassignedRemoteShards)/totalNumberOfSearchNodes

Related component

Search:Searchable Snapshots

To Reproduce

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

RemoteShardsBalancer should rebalance shards as expected

Additional Details

Plugins
Please list all plugins currently enabled.

Screenshots
If applicable, add screenshots to help explain your problem.

Host/Environment (please complete the following information):

  • OS: [e.g. iOS]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

@bugmakerrrrrr
Copy link
Contributor Author

@kotwanikunal @andrross you might be interested in this :)

@bugmakerrrrrr bugmakerrrrrr linked a pull request Aug 21, 2024 that will close this issue
3 tasks
@mch2 mch2 removed the untriaged label Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Search:Searchable Snapshots
Projects
Status: 🆕 New
Development

Successfully merging a pull request may close this issue.

2 participants