-
Notifications
You must be signed in to change notification settings - Fork 982
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
TaskExecutor waits for all tasks to complete before returning #12523
TaskExecutor waits for all tasks to complete before returning #12523
Conversation
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.
Thanks for working on this @quux00 ! The fix looks good to me, I think we can improve on the testing side, I left a comment around that.
lucene/core/src/java/org/apache/lucene/search/TaskExecutor.java
Outdated
Show resolved
Hide resolved
lucene/core/src/test/org/apache/lucene/search/TestIndexSearcher.java
Outdated
Show resolved
Hide resolved
a811d0e
to
51d47e5
Compare
waits until all tasks have finished before returning, even when one or more of the tasks throw an Exception.
…ion to the original one
…tion to use a CountDownLatch rather than sleep
51d47e5
to
ba5d115
Compare
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 left some nits on the testing part but it looks good already. Thanks!
lucene/core/src/test/org/apache/lucene/search/TestIndexSearcher.java
Outdated
Show resolved
Hide resolved
lucene/core/src/test/org/apache/lucene/search/TestIndexSearcher.java
Outdated
Show resolved
Hide resolved
lucene/core/src/test/org/apache/lucene/search/TestIndexSearcher.java
Outdated
Show resolved
Hide resolved
lucene/core/src/test/org/apache/lucene/search/TestIndexSearcher.java
Outdated
Show resolved
Hide resolved
lucene/core/src/test/org/apache/lucene/search/TestIndexSearcher.java
Outdated
Show resolved
Hide resolved
…ion to use a deterministic single-threaded executor
lucene/core/src/test/org/apache/lucene/search/TestIndexSearcher.java
Outdated
Show resolved
Hide resolved
d9eb713
to
3ed2489
Compare
This looks great thanks @quux00 ! Could you add an entry to the lucene/CHANGES.txt file under Lucene 9.9 please? |
f206f52
to
6be6d13
Compare
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.
LGTM
Thanks @quux00 ! |
The TaskExecutor used to run concurrent operations may leave running tasks behind when an exception is thrown by one of the tasks. This commit ensures that it instead waits for all tasks to complete before it re-throws the exception. If there's more than one exception thrown, they are going to be added as suppressed exceptions to the first one that was caught.
…#12523) The TaskExecutor used to run concurrent operations may leave running tasks behind when an exception is thrown by one of the tasks. This commit ensures that it instead waits for all tasks to complete before it re-throws the exception. If there's more than one exception thrown, they are going to be added as suppressed exceptions to the first one that was caught.
The TaskExecutor used by IndexSearcher and AbstractKnnVectorQuery
waits until all tasks have finished before returning, even when
one or more of the tasks throw an Exception.
Relates #12278