Auto-expand replicas should clamp to closest value #84788
Labels
>bug
:Distributed Coordination/Allocation
All issues relating to the decision making around placing a shard (both master logic & on the nodes)
Team:Distributed (Obsolete)
Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination.
Elasticsearch Version
All
Installed Plugins
N/A
Java Version
bundled
OS Version
N/A
Problem Description
Today if an index has an
index.auto_expand_replicas
setting which cannot be realised in the cluster then the number of replicas is left unchanged byAllocationService#adaptAutoExpandReplicas()
. Instead, I think we should change the number of replicas to the closest value within the permitted range.For instance: if a cluster has a single data node which is marked as shutting down for restart then auto-expand replicas considers this cluster to have zero data nodes, and hence requires -1 replicas. If an index is created with
index.auto_expand_replicas: "0-1"
then it will not be adjusted to have zero replicas, even though this would be better than leaving it at the default value of 1 replica, and will ultimately be the correct setting.Steps to Reproduce
RESTART
shutdown marker on the data node.index.auto_expand_replicas: "0-1"
Logs (if relevant)
No response
The text was updated successfully, but these errors were encountered: