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.
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:
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.
https://github.com/opensearch-project/OpenSearch/blob/e8ee6db87e55f66e28b46fac90bf2a4b33755160/server/src/main/java/org/opensearch/cluster/routing/allocation/allocator/RemoteShardsBalancer.java#L247-L251
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:
Related component
Search:Searchable Snapshots
To Reproduce
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):
Additional context Add any other context about the problem here.