-
Notifications
You must be signed in to change notification settings - Fork 24.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Snapshot restore requests allow you to restore alias with write data stream, even if the alias already has a write data stream #80976
Comments
Pinging @elastic/es-distributed (Team:Distributed) |
Pinging @elastic/es-data-management (Team:Data Management) |
If an alias with same name does exist in the cluster then restore logic tries to merge This behaviour already existed when restoring indices aliases from a snapshot:
After thinking about this more about this, I tend to agree that throwing an error is better. |
Thanks for looking into this @martijnvg.
The key differentiator here is the presence of a write index or write data stream. A more comparable example for an index alias would be:
This returns:
I'd expect ES to return a similar error for data stream aliases with conflicting write data streams. |
Good point. I started comparing the behaviour with aliases and overlooked that.
Yes, I think in this case of a write data stream we always want to return an error. No need for a parameter that controls the merging behaviour of data stream aliases or something like that. |
…stream Prohibit restoring a data stream alias if its write data stream conflicts with the write data stream of an existing data stream alias. Currently, the write data stream of data stream alias in the snapshot is ignored and the write data stream of the data stream alias currently active in the cluster is always picked. Closes elastic#80976
…stream (#81217) Prohibit restoring a data stream alias if its write data stream conflicts with the write data stream of an existing data stream alias. Currently, the write data stream of data stream alias in the snapshot is ignored and the write data stream of the data stream alias currently active in the cluster is always picked. In order to resolve this properly, I've merged the merge(...) and renameDataStreams(...) methods into a restore(...) method, which merges a data stream and does renaming at the same time. This should be ok, since renaming can only be done as part of restoring. More importantly, this allows to validate whether an existing alias and an alias from a snapshot to not have conflicting write data streams while at the same time allowing that a write data stream to be renamed (because data streams got renamed). Closes #80976
…stream (elastic#81217) Prohibit restoring a data stream alias if its write data stream conflicts with the write data stream of an existing data stream alias. Currently, the write data stream of data stream alias in the snapshot is ignored and the write data stream of the data stream alias currently active in the cluster is always picked. In order to resolve this properly, I've merged the merge(...) and renameDataStreams(...) methods into a restore(...) method, which merges a data stream and does renaming at the same time. This should be ok, since renaming can only be done as part of restoring. More importantly, this allows to validate whether an existing alias and an alias from a snapshot to not have conflicting write data streams while at the same time allowing that a write data stream to be renamed (because data streams got renamed). Closes elastic#80976
…stream (#81217) (#81843) Prohibit restoring a data stream alias if its write data stream conflicts with the write data stream of an existing data stream alias. Currently, the write data stream of data stream alias in the snapshot is ignored and the write data stream of the data stream alias currently active in the cluster is always picked. In order to resolve this properly, I've merged the merge(...) and renameDataStreams(...) methods into a restore(...) method, which merges a data stream and does renaming at the same time. This should be ok, since renaming can only be done as part of restoring. More importantly, this allows to validate whether an existing alias and an alias from a snapshot to not have conflicting write data streams while at the same time allowing that a write data stream to be renamed (because data streams got renamed). Closes #80976
Elasticsearch version (
bin/elasticsearch --version
):Version: 8.1.0-SNAPSHOT, Build: default/tar/e38cadb5283feeea06f09d555dbe47fb1d5e8b39/2021-11-22T22:35:22.825882Z, JVM: 17.0.1
OS version (
uname -a
if on a Unix-like system):Darwin 20.6.0 Darwin Kernel Version 20.6.0: Mon Aug 30 06:12:21 PDT 2021; root:xnu-7195.141.6~3/RELEASE_X86_64 x86_64
Description of the problem including expected versus actual behavior:
I expect ES to reject snapshot restore requests that restore an alias with a write data stream if that alias already exists and has another write data stream. However, ES currently accepts these requests. It appears that the alias uses the restored write data stream, which may be unexpected and confusing to users.
This is likely related to #80972.
Steps to reproduce:
logs-my_app-default
data stream.logs
alias to the data stream and set it as the write data stream.logs-my_other_app-default
, and add it as the write data stream to thelogs
alias.logs-my_app-default
data stream and its aliases from the snapshot.I expected this to return an error like
alias [logs] has more than one write index [logs-my_other_app-default,logs-my_app-default]
. This occurs for index aliases in a similar situation. However, the request was accepted.When you check the
logs
alias, the restoredlogs-my_app-default
data streamis the current write data stream:
Returns:
The text was updated successfully, but these errors were encountered: