RATIS-2514. Fix flaky TestReadOnlyRequestWithGrpc.testReadAfterWrite.#1446
Open
slfan1989 wants to merge 1 commit intoapache:RATIS-1931_grpc-zero-copyfrom
Open
RATIS-2514. Fix flaky TestReadOnlyRequestWithGrpc.testReadAfterWrite.#1446slfan1989 wants to merge 1 commit intoapache:RATIS-1931_grpc-zero-copyfrom
slfan1989 wants to merge 1 commit intoapache:RATIS-1931_grpc-zero-copyfrom
Conversation
szetszwo
reviewed
May 5, 2026
Contributor
szetszwo
left a comment
There was a problem hiding this comment.
@slfan1989 , this problem probably has already be fixed in the master branch. Since the difference between two branches are huge. I suggest doing a merge/rebase first.
- RATIS-1931_grpc-zero-copy 238 commits ahead of and 350 commits behind master.
| client.async().sendReadAfterWrite(queryMessage).thenAccept(reply -> { | ||
| Assertions.assertEquals(2, retrieve(reply)); | ||
| }); | ||
| client.async().send(incrementMessage).get(); |
Contributor
There was a problem hiding this comment.
The sendReadAfterWrite feature is for two async calls, (1) writeAsync and then (2) readAfterWriteAsync such that (2) must be able see the change by (1). So, we cannot call get() here. Otherwise, the test becomes useless. For exampe,
- initial: X = 1
- writeAsync: set X = 3
- readAfterWriteAsync: must see X = 3 (it is a bug if it can see X = 1)
This may be a bug already fixed (and moved to LinearizableReadTests) in the master branch.
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.
What changes were proposed in this pull request?
This pull request fixes a flaky assertion in
TestReadOnlyRequestWithGrpc.testReadAfterWrite.The previous test sent multiple async writes without waiting for them to complete, then issued a linearizable read and a read-after-write request concurrently. It asserted that the read-after-write result should be greater than or equal to the concurrent linearizable read result.
That assumption is unreliable because the two reads may have different linearization points and may observe different subsets of concurrent writes.
This patch keeps the original async write workload and both read paths, but makes the test deterministic by:
What is the link to the Apache JIRA
RATIS-2514. Fix flaky TestReadOnlyRequestWithGrpc.testReadAfterWrite.
How was this patch tested?
Tested with:
Result: