How does Elasticsearch handleindex.routing.allocation.total_shards_per_node getting set to 0 ? Setting it to 0 is obviously something that doesn't make sense to do, but Elasticsearch allows it to be done, so what if it is?
In my testing it seems like maybe the setting is ignored. If I set it for an index it's health remains green. If I remove a node one of the index's shards is on, the shard is recreated on another node.
That's correct, 0 (and -1) mean the limit is disabled:
-1 is the default value, used as a sentinel to mean "not set" -- this is a common pattern for many other settings regardless of whether 0 is a sensible value or not. In principle we could reject 0 here as well as numbers less than -1, but this would be a breaking change and we'd have to deprecate it first and maintain backwards compatibility with older nodes during a rolling upgrade and so on, so it would take quite some effort for IMO very little practical gain.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.