Skip to content

[FIXED] NRG: Don't compact on catchup until snapshot written#7043

Merged
neilalexander merged 1 commit intomainfrom
neil/nrgcompact
Jul 7, 2025
Merged

[FIXED] NRG: Don't compact on catchup until snapshot written#7043
neilalexander merged 1 commit intomainfrom
neil/nrgcompact

Conversation

@neilalexander
Copy link
Copy Markdown
Member

The n.wal.Compact() call before n.installSnapshot() is potentially dangerous in a crash scenario as we could blow away the log without having written the snapshot to disk yet. Once the snapshot is written, n.installSnapshot() will compact the log itself to the same index (as lastIndex == n.pindex).

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

The `n.wal.Compact()` call before `n.installSnapshot()` is potentially
dangerous in a crash scenario as we could blow away the log without
having written the snapshot to disk yet. Once the snapshot is written,
`n.installSnapshot()` will compact the log itself to the same index (as
`lastIndex == n.pindex`).

Signed-off-by: Neil Twigg <neil@nats.io>
@neilalexander neilalexander requested a review from a team as a code owner July 7, 2025 11:40
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

@neilalexander neilalexander merged commit cf5239b into main Jul 7, 2025
90 of 92 checks passed
@neilalexander neilalexander deleted the neil/nrgcompact branch July 7, 2025 11:58
@wallyqs wallyqs changed the title NRG: Don't compact on catchup until snapshot written [FIXED] NRG: Don't compact on catchup until snapshot written Jul 24, 2025
neilalexander added a commit that referenced this pull request Jul 25, 2025
Includes the following:

- #7031
- #7033
- #7034
- #7035
- #7036
- #7040
- #7043
- #7045
- #7047
- #7046
- #7050
- #7051
- #7052
- #7053
- #7061
- #7063
- #7064
- #7065
- #7066
- #7070
- #7072
- #7080
- #7026
- #6728
- #7074
- #7089
- #7095
- #7087
- #7094
- #7096
- #7099

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