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
Fix edge case for active flag for flush on idle #97332
Fix edge case for active flag for flush on idle #97332
Conversation
Basically the active flag needs to be set to true after the op has been processed by the engine. Else there is an edge case, which may leave unprocessed ops and active false, without a next flush on idle scheduled. Introducing a test for this edge case. Fixes elastic#97154
Hi @kingherc, I've created a changelog YAML for you. |
Pinging @elastic/es-distributed (Team:Distributed) |
t.start(); | ||
assertBusy(() -> assertThat(rwl.getQueueLength(), equalTo(1))); | ||
assertFalse(shard.isActive()); | ||
} // Allow op to complete |
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.
Should we also trigger a flush on idle here? If I understand correctly we want to test a race between an ongoing operation and the flush on idle?
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.
Well, the race was happening if the flush on idle completed before the operation was fully processed. Now that we set the active flag after the operation has been processed, we do not have the race anymore.
Putting a flush on idle here will basically be a no-op because the active
flag is already false and it will be skipped (the flush on idle actually flushes if the active
flag is 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.
Right, a flush on idle will now be a noop so my suggestion won't make much sense.
Thanks for confirming my understanding
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
Basically the active flag needs to be set to true after the op has been processed by the engine. Else there is an edge case, which may leave unprocessed ops and active false, without a next flush on idle scheduled. Introducing a test for this edge case.
Fixes #97154