elastic / elasticsearch

Free and Open, Distributed, RESTful Search Engine
https://www.elastic.co/products/elasticsearch
Other
69.45k stars 24.58k forks source link

Better rollover handling of small and empty indices #89283

Open joegallo opened 2 years ago

joegallo commented 2 years ago

This meta issue tracks some enhancements and other changes around handling rollovers (especially ILM rollovers) better in the cases of small or empty indices.

elasticsearchmachine commented 2 years ago

Pinging @elastic/es-data-management (Team:Data Management)

joegallo commented 1 year ago

re: https://github.com/elastic/elasticsearch/issues/83039 (that we don't have an especially great way to 'retire' an alias or datastream that's not going to be written to anymore):

At the moment we have some error conditional handling around situations where the index in question is unexpectedly marked with index.lifecycle.indexing_complete set to true:

https://github.com/elastic/elasticsearch/blob/1a3032beb6790805b2bba01180f9b875ac2fa971/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/WaitForRolloverReadyStep.java#L130-L168

A potentially interesting implementation of alias/datastream 'retirement' would be to revise that logic a bit so that we could merely mark an index as finished by setting index.lifecycle.indexing_complete to true and then having ILM continue past check-rollover-ready and continue on through the rest of the lifecycle. In order to make this work, though, we'd need to juggle is_write_index when we see this (since the rollover itself wouldn't handle that anymore). Taking that a step further, for datastreams that would open up the possibility that a datastream would have no current write index, so a nearby or parallel effort to this would be having the ability to make a datastream read only.