-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Fix ThreadPoolMergeSchedulerStressTestIT testMergingFallsBehindAndThenCatchesUp #125956
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
Conversation
|
Pinging @elastic/es-distributed-indexing (Team:Distributed Indexing) |
| void allowAllMerging() { | ||
| // even when indexing is done, queued and backlogged merges can themselves trigger further merging | ||
| // don't let this test be bothered by that, and simply let all merging run unhindered | ||
| runMergeSemaphore.release(Integer.MAX_VALUE - initialRunMergesCount); |
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.
The semaphore was also released when excess merges were enqueued. This is a dynamic process. I preferred I not fudge an upper limit value, or put Integer.MAX_VALUE / 2 ...
| // await all merging to catch up | ||
| assertBusy(() -> { | ||
| // unblock merge threads | ||
| testEnginePlugin.allowAllMerging(); |
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.
Dynamically release merge permits until everything's done.
| runMergeSemaphore.release(Integer.MAX_VALUE - initialRunMergesCount); | ||
| if (runMergeSemaphore.availablePermits() < 10_000) { | ||
| runMergeSemaphore.release(10_000); | ||
| } |
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 am not quite sure what we are doing here. Isn't the maximum number of permits we can release = initialRunMergesCount - runMergeSemaphore.availablePermits() ?
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.
We need to release as many permits as there are merges, but we don't know how many of those are going to be generated (depends on many parameters). And the fact that there is some "background" merging while merging is otherwise mostly stopped, complicates computations.
henningandersen
left a comment
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.
| // even when indexing is done, queued and backlogged merges can themselves trigger further merging | ||
| // don't let this test be bothered by that, and simply let all merging run unhindered | ||
| runMergeSemaphore.release(Integer.MAX_VALUE - initialRunMergesCount); | ||
| if (runMergeSemaphore.availablePermits() < 10_000) { |
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.
How can it have more than 10K available already? Should we instead assert it has not?
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.
It can't have more than 10K, or Integer.MAX_VALUE / 2, 99999, etc...
It's just strange to fudge any sort of non-obvious value, but on the other hand, the shenanigans required to avoid that are not worth it. I'll fudge a value, and drop a comment.
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.
Pushed 03df3d1
…nCatchesUp (elastic#125956) We don't know how many semaphore merge permits we need to release, or how many are already released. Fixes elastic#125744
…nCatchesUp (elastic#125956) We don't know how many semaphore merge permits we need to release, or how many are already released. Fixes elastic#125744
We don't know how many semaphore merge permits we need to release, or how many are already released.
Fixes #125744