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

NRG (2.11): Fix term handling in candidate state and use higher term from vote request #5671

Merged
merged 1 commit into from
Jul 22, 2024

Conversation

neilalexander
Copy link
Member

@neilalexander neilalexander commented Jul 18, 2024

A candidate could incorrectly revert to an older term without resetting if an old AE arrived with a term that is at least newer than the pterm but not necessarily newer than the term.

Additionally, we also weren't handling the case that the rest of the cluster should assume the higher term number from the vote requests once an isolated candidate node rejoins the cluster.

This PR also rewrites TestNRGCandidateStepsDownAfterAE and replaces it with TestNRGAssumeHighTermAfterCandidateIsolation as the old test was checking for flawed behaviour: it was relying on the term being able to go backwards after a period of isolation, which is not correct. Instead we should prove that the rest of the cluster assumes the higher term from the isolated node.

Co-authored-by: Reuben Ninan reuben@nats.io
Signed-off-by: Neil Twigg neil@nats.io

@neilalexander neilalexander requested a review from a team as a code owner July 18, 2024 09:29
@neilalexander neilalexander marked this pull request as draft July 18, 2024 09:49
@neilalexander neilalexander changed the title NRG (2.11): Fix term handling in candidate state NRG (2.11): Fix term handling in candidate state and use higher term from vote request Jul 18, 2024
…te request

A candidate could incorrectly revert to an older term without resetting
if an old AE arrived with a term that is at least newer than the pterm
but not necessarily newer than the term.

Also a node that is isolated for a period of time with a high term number
should cause the rest of the cluster to move forward with that term number,
rather than going backwards to the leader term.

Co-authored-by: Reuben Ninan <reuben@nats.io>
Signed-off-by: Neil Twigg <neil@nats.io>
@neilalexander neilalexander marked this pull request as ready for review July 19, 2024 12:56
Copy link
Member

@derekcollison derekcollison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@derekcollison derekcollison merged commit c8eb521 into main Jul 22, 2024
5 checks passed
@derekcollison derekcollison deleted the neil/nrgcandidateae branch July 22, 2024 15:42
neilalexander added a commit that referenced this pull request Nov 25, 2024
Includes the following:

- #5661
- #5666
- #5671
- #5344
- #5684
- #5689
- #5691
- #5714
- #5717
- #5707
- #5792
- #5912
- #5957
- #5700
- #5975
- #5991
- #5987
- #6027
- #6038
- #6053
- #5848
- #6055
- #6056
- #6060
- #6061
- #6072
- #5832
- #6073
- #6107

Signed-off-by: Neil Twigg <neil@nats.io>
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.

2 participants