Skip to content
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

Bulk cluster state updates on index deletion #11258

Merged
merged 1 commit into from
Oct 27, 2015
Merged

Bulk cluster state updates on index deletion #11258

merged 1 commit into from
Oct 27, 2015

Conversation

memcmp
Copy link

@memcmp memcmp commented May 20, 2015

This fix is related to #7295

Currently a ClusterState update is issued for every index when deleting multiple indices, this causes timeout errors in most cases when deleting a large amount of indices. We changed the behavior so only one clusterState update (maximum two if some indices are locked ) is issued when deleting multiple indices. This makes large delete index operations much more faster and more fail-safe.

@clintongormley clintongormley changed the title B/reduce cluster state updates on index deletion Bulk cluster state updates on index deletion May 25, 2015
@clintongormley
Copy link

@s1monw could you review this please?

@clintongormley clintongormley assigned javanna and s1monw and unassigned s1monw and javanna Jun 26, 2015
@s1monw
Copy link
Contributor

s1monw commented Jun 26, 2015

hey, this has not been forgotten... I wonder if we do need to do some higher level refactorings to this area of the code. I will look into it next week and come back to this.

@s1monw
Copy link
Contributor

s1monw commented Oct 16, 2015

@bogensberger I finally found the time to look closer at this. It always bugged me that we had a list of semaphores to acquire and maintain across the lifetime of the delete. This is super error prone and was the main reason why we didn't move forward here sooner. I spend the day looking into why it is needed and what the reasons were why it was added (in 0.17.0) ;) ie. 200 years ago... anyway I am sure we fixed all the problems that lead to the addition of these semaphores in other PRs in 1.x already so we can remove the locking and just go ahead without the locks. I opened #14159 to get rid of it which I will port for 2.2 once it's in would you mind bringing this up to date?

@s1monw s1monw added v2.2.0 and removed v2.1.0 labels Oct 16, 2015
@memcmp
Copy link
Author

memcmp commented Oct 19, 2015

@s1monw yes, i will do.

@s1monw
Copy link
Contributor

s1monw commented Oct 19, 2015

@bogensberger I pushed it to master... please go ahead!

@memcmp
Copy link
Author

memcmp commented Oct 20, 2015

@s1monw thanks, i've updated the PR

@s1monw
Copy link
Contributor

s1monw commented Oct 23, 2015

it looks good to me @javanna can you please take a look at this as well

Collection<String> indices = Arrays.asList(request.indices);
final DeleteIndexListener deleteListener = new DeleteIndexListener(userListener);

clusterService.submitStateUpdateTask("delete-index [" + indices + "]", Priority.URGENT, new ClusterStateUpdateTask() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we might end up with double square brackets here given that the string representation of the list will be like
"[index1, index2, index3]" already.

@javanna
Copy link
Member

javanna commented Oct 23, 2015

I had a quick look at this and left a few minor comments, looks very good though. I might be getting confused, but I think this one makes #11189 obsolete, and it's a very good change, long overdue. @bogensberger do you have time to address those minor comments so we can pull this in?

@s1monw
Copy link
Contributor

s1monw commented Oct 27, 2015

@bogensberger if you don't have time to apply the changes I can do it... but I'd love if you could do it :)

@memcmp
Copy link
Author

memcmp commented Oct 27, 2015

@s1monw i will do it!

@s1monw
Copy link
Contributor

s1monw commented Oct 27, 2015

@bogensberger awesome thanks!

@memcmp
Copy link
Author

memcmp commented Oct 27, 2015

@javanna @s1monw i'v done the changes and also squashed them.

@javanna
Copy link
Member

javanna commented Oct 27, 2015

looks great thanks @bogensberger !

s1monw added a commit that referenced this pull request Oct 27, 2015
…n_index_deletion

Bulk cluster state updates on index deletion
@s1monw s1monw merged commit dde5e83 into elastic:master Oct 27, 2015
@s1monw
Copy link
Contributor

s1monw commented Oct 27, 2015

merged into master - I will port to 2.x after it's seen some CI cycles thanks @bogensberger

s1monw added a commit to s1monw/elasticsearch that referenced this pull request Oct 27, 2015
…dates_on_index_deletion

Bulk cluster state updates on index deletion
javanna added a commit to javanna/elasticsearch that referenced this pull request Oct 27, 2015
This commit fixes a regression introduced with elastic#12058. This causes failures with the delete index api when providing the same index name multiple times in the request, or aliases/wildcard expressions that end up pointing to the same concrete index. The bug was revealed after merging elastic#11258 as we delete indices in batch rather than one by one. The master node will expect too many acknowledgements based on the number of indices that it's trying to delete, hence the request will never be acknowledged by all nodes.

Closes elastic#14316
javanna added a commit to javanna/elasticsearch that referenced this pull request Oct 27, 2015
This commit fixes a regression introduced with elastic#12058. This causes failures with the delete index api when providing the same index name multiple times in the request, or aliases/wildcard expressions that end up pointing to the same concrete index. The bug was revealed after merging elastic#11258 as we delete indices in batch rather than one by one. The master node will expect too many acknowledgements based on the number of indices that it's trying to delete, hence the request will never be acknowledged by all nodes.

Closes elastic#14316
javanna added a commit to javanna/elasticsearch that referenced this pull request Oct 27, 2015
This commit fixes a regression introduced with elastic#12058. This causes failures with the delete index api when providing the same index name multiple times in the request, or aliases/wildcard expressions that end up pointing to the same concrete index. The bug was revealed after merging elastic#11258 as we delete indices in batch rather than one by one. The master node will expect too many acknowledgements based on the number of indices that it's trying to delete, hence the request will never be acknowledged by all nodes.

Closes elastic#14316
javanna added a commit to javanna/elasticsearch that referenced this pull request Oct 27, 2015
This commit fixes a regression introduced with elastic#12058. This causes failures with the delete index api when providing the same index name multiple times in the request, or aliases/wildcard expressions that end up pointing to the same concrete index. The bug was revealed after merging elastic#11258 as we delete indices in batch rather than one by one. The master node will expect too many acknowledgements based on the number of indices that it's trying to delete, hence the request will never be acknowledged by all nodes.

Closes elastic#14316
@clintongormley clintongormley added :Distributed/Distributed A catch all label for anything in the Distributed Area. If you aren't sure, use this one. and removed :Cluster labels Feb 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Distributed/Distributed A catch all label for anything in the Distributed Area. If you aren't sure, use this one. v2.2.0 v5.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants