Skip to content

Segment writer: read the full snapshot state ETS record atomically.#591

Merged
kjnilsson merged 1 commit intomainfrom
snapshot-write-snapshot-state-fix
Mar 13, 2026
Merged

Segment writer: read the full snapshot state ETS record atomically.#591
kjnilsson merged 1 commit intomainfrom
snapshot-write-snapshot-state-fix

Conversation

@kjnilsson
Copy link
Copy Markdown
Contributor

The current approoch of reading the snapshot index then the live indexes is prone to a race condition where the snapshot state is updated in betweeen reading the snapshot index and the live indexes.

E.g.

Snapshot is taken at index 10 with [7, 5, 3, 1]
Snapshot is taken at index 15 with [13, 11, 5, 3, 1]

Segment writer reads live indexes [7, 5, 3, 1] but snapshot index 15.

13 and 11 will not be written but 7 will be unnecesarily.

The current approoch of reading the snapshot index then the live
indexes is prone to a race condition where the snapshot state
is updated in betweeen reading the snapshot index and the live indexes.

E.g.

Snapshot is taken at index 10 with [7, 5, 3, 1]
Snapshot is taken at index 15 with [13, 11, 5, 3, 1]

Segment writer reads live indexes [7, 5, 3, 1] but snapshot index 15.

13 and 11 will not be written but 7 will be unnecesarily.
@kjnilsson kjnilsson merged commit 7fd1e17 into main Mar 13, 2026
7 checks passed
@michaelklishin michaelklishin added this to the 3.0.2 milestone Mar 13, 2026
@dumbbell-rabbitmq dumbbell-rabbitmq deleted the snapshot-write-snapshot-state-fix branch March 23, 2026 14:54
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