-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Order of atomic alias operations seems inconsistent #27689
Comments
I did some digging and this has to do with the fact that we treat aliases in the remove command as wild card expressions and resolve them in advance against the cluster state before we run the command. This means that if the alias was not there when we started, the remove command will never be executed when the cluster state update. I think this is trappy as there is no correlation between the cluster state that this pre filtering is run on and the cluster state which actually serves as base for the commands execution. On top of it it doesn't account for relationship between commands. I think we should not prefilter and resolve wild cards when we execute the commands on the cluster state thread. |
Currently aliases' names are resolved in advance against the cluster state at the point of time before executing an alias update command command. This means that if an alias was not there when we started this command, but created as a part of this command, the subsequent remove operation within the same command on the same alias will not be able to find this alias, and will not be executed. This is not correct as there is no correlation between the cluster state that the alias resolution is run on and the cluster state which actually serves as base for the commands execution. On top of this, the current situation doesn't account for relationship between commands. This commit postpones aliases' wild card resolution until we execute the commands on the cluster state thread, so the resolution is run on the cluster state we are modifying. Closes elastic#27689
I added the [discuss] label because I would like to discuss this in the context of eagerness to validate. This issue comes up with regards to #28231, and #30195. This also influences whether certain data-structures that are useful for early validation have value in being created as metadata is being changed and built by alias actions, rather than being re-created and validated all at once after all actions (whether legal or not, depending on the order) when the final MetaData is being built and validated (re: #29575). to highlight some examples that all behave differently:
|
@bleskes what would you like to do on this issue? |
@tomcallahan we discussed it in the core infra sync a while ago and agree that the actions should be applied one by one, modifying things as they go, based on the output of the previous command. If I recall correctly, the conversation went with validating correctness on every step. That said, is write index validation ended being done once in the end, so we might need to revisit it. Bottom line - it's a valid issue and someone needs to pick it up. I expect more work here as the alias code needs some cleanup IMO. I believe that is also what made @mayya-sharipova fight an up hill battle with her PR. |
@bleskes To confirm, you were saying that we need to take another approach for this. So, I am going to close my previous PR on this, and somebody else can work on it. |
@mayya-sharipova I think your PR is an improvement but indeed, this should be picked up in a more structural way. I'm OK with you just closing it, if you're not going to spend more time in that area (and otherwise we need to finish that discussion we started) |
Does that mean that renaming an alias is not working properly? https://www.elastic.co/guide/en/elasticsearch/reference/6.2/indices-aliases.html
|
@ddreonomy The renaming of alias should work well. If you experience any problem, please create a separate issue. |
Executing an atomic alias operations on the same index and same alias returns inconsistent results:
To sum up:
The same request will produce different result:
The text was updated successfully, but these errors were encountered: