fix: replay unflushed WAL entries into memtable on restart#6532
Closed
hamersaw wants to merge 2 commits intolance-format:mainfrom
Closed
fix: replay unflushed WAL entries into memtable on restart#6532hamersaw wants to merge 2 commits intolance-format:mainfrom
hamersaw wants to merge 2 commits intolance-format:mainfrom
Conversation
On crash/restart, WAL entries that were written but not yet flushed to a generation were silently lost. The memtable started empty, dropping any data durably written to the WAL. This adds replay logic in ShardWriter::open() that scans WAL entries from replay_after_wal_entry_position + 1 forward, inserting them back into the memtable before accepting new writes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
# Conflicts: # rust/lance/src/dataset/mem_wal/wal.rs
Contributor
|
I think this one is fixed in #6675 now |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
WalFlusher::replay_wal_entries()that scans fromreplay_after_wal_entry_position + 1forward, re-inserting non-empty WAL entries into the memtableShardWriter::open()before accepting new writes, withnext_wal_entry_positionadvanced past replayed entriesTest plan
test_replay_wal_entries— writes 3 WAL entries, simulates restart, verifies all 3 replayed into memtable with correct row countstest_replay_wal_entries_skips_already_flushed— verifies entries covered byreplay_after_wal_entry_positionare not replayedtest_replay_wal_entries_nothing_to_replay— verifies no-op when no WAL entries existmem_waltests pass with no regressions🤖 Generated with Claude Code