Skip to content

Conversation

@MauriceVanVeen
Copy link
Member

The Raft log can have three states:

  • no snapshot, and an empty WAL
  • no snapshot, and a WAL that starts from the very first entry with N entries
  • a snapshot, and the WAL continues onward from the snapshot with N entries

We previously were not checking that these align, this would allow for the snapshot to be non-existent but the WAL to be way ahead or there to be a gap (somehow) between the snapshot and WAL itself. Both could lead to data loss.
Normally this shouldn't be an issue though, as these will always align. But, could potentially happen if a snapshot and the tail of the WAL were durably written, but somehow the head of the WAL was not.

Signed-off-by: Maurice van Veen [email protected]

@MauriceVanVeen MauriceVanVeen requested a review from a team as a code owner December 5, 2025 13:19
@MauriceVanVeen MauriceVanVeen changed the title NRG: WAL must align with snapshot (2.14?) NRG: WAL must align with snapshot Dec 5, 2025
Comment on lines 3963 to 3968
// Stop current node and restart it.
n.Stop()
n.WaitForStop()
// Restart.
n.Stop()
n.WaitForStop()
Copy link
Contributor

Choose a reason for hiding this comment

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

Huh?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, just left around due to copy pasting, resolved now.

Signed-off-by: Maurice van Veen <[email protected]>
@MauriceVanVeen MauriceVanVeen force-pushed the maurice/nrg-wal-alignment branch from b2c2b0a to aaaa8ba Compare December 5, 2025 13:55
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