KAFKA-20423: Fix flakiness of testWakeupWithFetchDataAvailable (More) - #23367
Open
chickenchickenlove wants to merge 1 commit into
Open
KAFKA-20423: Fix flakiness of testWakeupWithFetchDataAvailable (More)#23367chickenchickenlove wants to merge 1 commit into
chickenchickenlove wants to merge 1 commit into
Conversation
Contributor
Author
|
@lianetm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The previous PR changed the test to wait until
MockClientinvokes the completion callback for the fetch response. However, this callback only registers a completion handler inpendingCompletion; it does not guarantee that the fetch data has already been added to theFetchBuffer.As a result, the following race condition can still occur:
fetchResponseCompleted, then verifies the wakeup exception and the position.consumer.poll(Duration.ZERO)has passed coordinator processing, the heartbeat thread removes the handler frompendingCompletion.FetchBufferas empty and return an empty result.This PR changes the wait condition to
fetcher.hasAvailableFetches(), ensuring that fetch data that can actually be returned is present in the buffer before callingwakeup().This removes the dependency of the subsequent poll's record verification on the timing of the heartbeat thread's completion processing.