-
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
Deleting multiple indices can fail to report all failures #11189
Deleting multiple indices can fail to report all failures #11189
Conversation
for (final String index : concreteIndices) { | ||
deleteIndexService.deleteIndex(new MetaDataDeleteIndexService.Request(index).timeout(request.timeout()).masterTimeout(request.masterNodeTimeout()), new MetaDataDeleteIndexService.Listener() { | ||
|
||
private volatile Throwable lastFailure; | ||
private volatile boolean ack = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we move ack
too together with lastFailure
please?
Could we also have a better description for the PR? I don't understand what it is doing. thanks |
@javanna i've signed the CLA and updated the commit so |
@clintongormley i've updated the PR description. I hope it's more clear now. |
@@ -83,22 +84,22 @@ protected void masterOperation(final DeleteIndexRequest request, final ClusterSt | |||
} | |||
// TODO: this API should be improved, currently, if one delete index failed, we send a failure, we should send a response array that includes all the indices that were deleted | |||
final CountDown count = new CountDown(concreteIndices.length); | |||
final AtomicReference<Throwable> lastFailure = new AtomicReference<>(); | |||
final AtomicReference<Boolean> ack = new AtomicReference<>(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think AtomicBoolean
would be better instead of AtomicReference<Boolean>
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah sry, AtomicBoolean is better of course - updated
thanks @bogensberger I just left a small comment, thanks a lot for updating, I will look into writing a test for this and merge it. |
if the last delete operation succeeded
@@ -83,22 +85,22 @@ protected void masterOperation(final DeleteIndexRequest request, final ClusterSt | |||
} | |||
// TODO: this API should be improved, currently, if one delete index failed, we send a failure, we should send a response array that includes all the indices that were deleted | |||
final CountDown count = new CountDown(concreteIndices.length); | |||
final AtomicReference<Throwable> lastFailure = new AtomicReference<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we somehow make this a synchronized list and report all failures? I'd just add 2-N failures as suppressed to the first?
@javanna can you come back to this? I added a comment but you worked on it before so I wonder if you have something to add? |
I agree with your comment @s1monw . I'd love to have a simple test for it as well, I meant to come up with one but I never got to it :( |
is this fixed by #11258 ? |
great closing then, thanks again @bogensberger ! Superseded by #11258 . |
awesome! |
@javanna I labeled it fixed in 2.2 and 3.0 no? |
currently a delete is performed for every concreteIndex within the
DeleteIndexRequest
.If an error occurs the exception is assigned to
lastFailure
and after the last delete is performed the error is passed to the listener (if one did occur).The problem is that lastFailure is declared within the listeners passed to
deleteIndexService.deleteIndex
and so only the failure of the last deleted index is considered and the errors of previous deleted indices are ignored. This patch fixes this behavior by declaringlastFailure
outside the loop.i had problems creating a proper test for this, maybe one of you can point me into the right direction or show me a similar test