Skip to content
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

ra_SUITE: Fix flake in consistent_query_leader_change #423

Merged

Conversation

the-mikedavis
Copy link
Member

The line:

{ok, 9, B} = ra:consistent_query(B, fun(S) -> S end)

would flake because B might fail to become the leader. ra:transfer_leadership/2 is asynchronous and fallible and in cases where the test flaked, B was recovering and catching up to the latest changes, so it didn't assume leadership.

We can wait for B to catch up enough that it should win pre-votes and then wait for it to assume leadership before asserting that B is the leader to fix the flake.

The line:

     {ok, 9, B} = ra:consistent_query(B, fun(S) -> S end),

would flake because `B` might fail to become the leader.
`ra:transfer_leadership/2` is asynchronous and fallible and in cases
where the test flaked, `B` was recovering and catching up to the latest
changes, so it didn't assume leadership.

We can wait for `B` to catch up enough that it should win pre-votes and
then wait for it to assume leadership before asserting that `B` is the
leader to fix the flake.
@michaelklishin michaelklishin merged commit bbba943 into main Feb 13, 2024
7 checks passed
@michaelklishin michaelklishin deleted the md-flake-ra_SUITE-consistent_query_leader_change branch February 13, 2024 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants