Guard data stream from double referencing an index when replacing a backing index #113090
Labels
>bug
:Data Management/Data streams
Data streams and their lifecycles
Team:Data Management
Meta label for data/management team
Elasticsearch Version
8.x
Installed Plugins
No response
Java Version
bundled
OS Version
N/A
Problem Description
Data streams offer an option to replace a backing index
replaceBackingIndex
.This method finds the reference of a backing index and replaces it with a new index.
Current behaviour:
However, it does not check if this new index is already referenced by this data stream. The other methods that are adding new backing indices to the data stream use the method
validateDataStreamAlreadyContainsIndex
to avoid double referencing an index.Expected behaviour
A data stream should "guard" itself from double referencing an index. We should either return the same instance of the data stream or throw an error. This needs to be investigated.
Steps to Reproduce
This is not the easiest reproduction path and it might not be the only, but it's one we are aware of:
At this point we have the index restored, but no ILM policy is applied
At this point the index is part of the data stream, but ILM cannot manage it due to missing ILM policy
At this point, we can see that the index is managed by ILM again
ILM will go through the steps, but when it's time to mount the searchable snapshot it will see that this snapshot is already mounted and it will replace
.ds-my-data-2024.09.18-000001
withpartial-.ds-my-data-2024.09.18-000001
and create the double reference we mentioned above:Logs (if relevant)
No response
The text was updated successfully, but these errors were encountered: