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

Cherry-picks for 2.10.23-RC.5 #6171

Merged
merged 36 commits into from
Nov 25, 2024
Merged

Cherry-picks for 2.10.23-RC.5 #6171

merged 36 commits into from
Nov 25, 2024

Conversation

neilalexander
Copy link
Member

@neilalexander neilalexander commented Nov 25, 2024

Includes the following:

Signed-off-by: Neil Twigg neil@nats.io

neilalexander and others added 30 commits November 22, 2024 17:01
Co-authored-by: Reuben Ninan <reuben@nats.io>
Signed-off-by: Neil Twigg <neil@nats.io>
…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>
The stepdown channel interleaves with other channels such as the apply queue,
leader change notifications etc in the `runAs` goroutines in an unpredictable
order, so processing a stepdown request might be delayed behind other work.
Doing this inline should be safer with stronger guarantees.

Signed-off-by: Neil Twigg <neil@nats.io>
Beforehand when we were trying to run a catchup, we were reverting the
`term` back to `pterm`. We can't ever move the term backwards safely and
the catchup itself does not rely on this behaviour in order to work (as
the catchup entries are matched only on `pindex`), so don't revert it.

Signed-off-by: Neil Twigg <neil@nats.io>
Log consistency should only be enforced when handling append entries,
not in other types of RPC. In this case, the higher term could cause
us to blow away our entire log if a node with a higher term but a more
out-of-date log comes along as leader.

Signed-off-by: Neil Twigg <neil@nats.io>
Signed-off-by: Neil Twigg <neil@nats.io>
Signed-off-by: Neil Twigg <neil@nats.io>
Otherwise we may end up in a situation where we are dropping append
entries from a leader that is obviously behind, but we cannot help
to bring the cluster forward to make progress.

Signed-off-by: Neil Twigg <neil@nats.io>
Candidates should not be stepping down based on their pterm but rather their actual term.

Signed-off-by: reubenninan <reuben@nats.io>
Signed-off-by: Neil Twigg <neil@nats.io>
Signed-off-by: Derek Collison <derek@nats.io>
Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
Antithesis testing has found that late or out-of-order delivery of these
snapshots, likely due to latency or thread pauses, can cause stream
assignments to be reverted which results in assets being deleted and
recreated. There may also be a race condition where the metalayer comes
up before network connectivity to all other nodes is fully established
so we may end up generating snapshots that don't include assets we don't
know about yet.

We will want to audit all uses of `SendSnapshot` as it somewhat breaks
the consistency model, especially now that we have fixed a significant
number of Raft bugs that `SendSnapshot` usage may have been papering
over.

Further Antithesis runs without this code run fine and have eliminated a
number of unexpected calls to `processStreamRemoval`.

We've also added a new unit test
`TestJetStreamClusterHardKillAfterStreamAdd` for a long-known issue, as
well as a couple tweaks to the ghost consumer tests to make them
reliable.

Signed-off-by: Neil Twigg <neil@nats.io>

---------

Signed-off-by: Neil Twigg <neil@nats.io>
Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
Co-authored-by: Maurice van Veen <github@mauricevanveen.com>
Signed-off-by: Neil Twigg <neil@nats.io>
Co-authored-by: Maurice van Veen <github@mauricevanveen.com>
Signed-off-by: Neil Twigg <neil@nats.io>
… at `seq=ae.pindex+1` (#5987)

This PR makes three complementary fixes to the way how catchup and
truncating is handled.
Specifically:
- when doing `n.loadEntry(index)` we need to pass where the AppendEntry
is in terms of stream sequence, this is equal to `ae.pindex+1` since the
`ae.pindex` is the value before it's stored in the stream.
- start catchup from `n.commit`, we could have messages past our commit
that have been invalidated and need to be truncated since there was a
switch between leaders
- because we catchup from `n.commit`, we check if our local AppendEntry
matches terms with the incoming AppendEntry, we only need to truncate if
the terms don't match

Signed-off-by: Maurice van Veen <github@mauricevanveen.com>

---------

Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
…mmitted

Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
Signed-off-by: Neil Twigg <neil@nats.io>
Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
If we haven't recovered the `pterm`/`pindex` from a snapshot, and the
WAL is empty, then we shouldn't tell other nodes that we have a log that
we don't have (i.e. by vote request). Instead leave both `pterm` and
`pindex` as zero to correctly signal that we don't know anything about
the state of the log.

Signed-off-by: Neil Twigg <neil@nats.io>
…g shutdown

Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
…sequent catchup messages

Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
This should fix some logical races where multiple sets of goroutines
can fight over the same store directory, i.e. when shutting down and
recreating a group rapidly.

Signed-off-by: Neil Twigg <neil@nats.io>
neilalexander and others added 6 commits November 25, 2024 10:21
Signed-off-by: Neil Twigg <neil@nats.io>
Signed-off-by: Neil Twigg <neil@nats.io>
Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
Signed-off-by: Neil Twigg <neil@nats.io>
Signed-off-by: Neil Twigg <neil@nats.io>
…g shutdown

Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
@neilalexander neilalexander marked this pull request as ready for review November 25, 2024 12:04
@neilalexander neilalexander requested a review from a team as a code owner November 25, 2024 12:04
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

@neilalexander neilalexander merged commit 24acb45 into release/v2.10.23 Nov 25, 2024
5 checks passed
@neilalexander neilalexander deleted the neil/21023rc5 branch November 25, 2024 12:47
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.

4 participants