Skip to content

[ADDED] Assert leader never receives appendEntry for same term#7248

Merged
neilalexander merged 1 commit intomainfrom
no-multiple-leaders
Sep 2, 2025
Merged

[ADDED] Assert leader never receives appendEntry for same term#7248
neilalexander merged 1 commit intomainfrom
no-multiple-leaders

Conversation

@sciascid
Copy link
Copy Markdown
Contributor

@sciascid sciascid commented Sep 2, 2025

Replace wrong comment about leaders that need to break tie when using same term, with a assert.Unreachable. Two leaders should never use the same term.

Signed-off-by: Daniele Sciascia daniele@nats.io

@sciascid sciascid requested a review from a team as a code owner September 2, 2025 09:46
Copy link
Copy Markdown
Member

@MauriceVanVeen MauriceVanVeen left a comment

Choose a reason for hiding this comment

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

LGTM

Replace wrong comment about leaders that need to break tie when
using same term, with a assert.Unreachable. Two leaders should
never use the same term.

Signed-off-by: Daniele Sciascia <daniele@nats.io>
@sciascid sciascid force-pushed the no-multiple-leaders branch from 7020dc7 to 55dd23a Compare September 2, 2025 10:55
@neilalexander neilalexander merged commit 351276e into main Sep 2, 2025
131 of 136 checks passed
@neilalexander neilalexander deleted the no-multiple-leaders branch September 2, 2025 21:37
MauriceVanVeen pushed a commit that referenced this pull request Sep 3, 2025
Replace wrong comment about leaders that need to break tie when using
same term, with a assert.Unreachable. Two leaders should never use the
same term.

Signed-off-by: Daniele Sciascia <daniele@nats.io>
@wallyqs wallyqs changed the title Assert leader never receives appendEntry for same term [ADDED] Assert leader never receives appendEntry for same term Sep 3, 2025
neilalexander added a commit that referenced this pull request Sep 8, 2025
Includes the following:
- #7200
- #7201
- #7202
- #7209
- #7210
- #7211
- #7213
- #7212
- #7216
- #7217
- #7230
- #7239
- #7246
- #7248
-
8241a15,
specifically delayed errors that are not JS API errors
- #7158 (not containing
2.12-specific changes)
- #7233
- #7255
- #7249
- #7259
- #7265
- #7273 (not including Go
1.25.x)
- #7258
- #7222

Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
Signed-off-by: Neil Twigg <neil@nats.io>
neilalexander added a commit that referenced this pull request Sep 11, 2025
Antithesis reproduced a case of `Two leaders using the same term`
(#7248) by having a server
receive a vote request to stepdown due to a leader with a higher term in
one goroutine, but at the same time shutting down the server which also
steps down the Raft nodes. This would then result in sending an append
entry for a leader transfer with the higher term, while not being leader
anymore.

Also fixes a case where we could technically perform catchup while not
being leader anymore, or with a too high term.

Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
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.

3 participants