fix(core): merge WAL generations across schema changes - #175
Merged
Conversation
beinan
force-pushed
the
fix/wal-schema-backcompat
branch
from
July 23, 2026 01:43
2038efa to
d0abbdd
Compare
beinan
force-pushed
the
fix/wal-schema-backcompat
branch
from
July 23, 2026 03:18
d0abbdd to
33f8e77
Compare
beinan
added a commit
that referenced
this pull request
Jul 26, 2026
…erate drained generations (#200) Three fixes the rollout store received but `DatagenStore` never did. Each is latent today and becomes reachable as soon as datagen sees concurrent or long-lived use. ## 1. Merge used the compile-time schema, not the live one `merge_own_shard` built its append batch from `datagen_log_schema()`. A base table written by an older binary can lack columns the current schema has, and merging a batch built from the compile-time schema into it **fails outright**. Now aligned via `align_batch_to_schema` — the rollout store hit exactly this and was fixed in #175. ## 2. `Drop` swallowed the writer's close error ```rust let _ = writer.close().await; // before ``` A failed close leaks the writer's background tasks and, if the memtable was still buffered, **strands rows that are durable in the WAL but never sealed** — with no signal anywhere. Now logged, and the no-runtime path says so too. (Rollout equivalent: #190.) ## 3. A concurrently-drained generation failed the whole lookup `get_blob` propagated not-found when a merge drained and deleted a generation between snapshot and open. Those rows are already in the base table, so it now skips and falls through — as the rollout store does. ## Sharing `align_batch_to_schema` and `is_not_found_error` become `pub(crate)` so both stores share one implementation instead of drifting again. This drift is the actual pattern here: all three bugs are cases where rollout was fixed and datagen was not. ## Scope note — worth reading I expected datagen to have the write-lock stall fixed in #199. **It does not**, and I verified rather than assumed: - `DatagenStore::append` is already `&mut self` (its writer is a bare `Option<ShardWriter>`, not behind a mutex), so appends need the exclusive lock **regardless of merge** — the read/write lock split from #199 would buy nothing. - `write_with_resident_writer` already retries on fence, so `claim_epoch` fencing its own writer is handled. Restoring `claim_epoch` leaves the new test **green**, confirming this empirically. - Datagen is not yet wired into any server route or sweeper. So the epoch change from #199 is deliberately **not** ported. These three divergences are the real defects. ## Testing New test asserts a merge does not fence the store's own resident writer, so an append immediately after a merge still succeeds and both rows stay readable, and a second merge still converges. 9 datagen tests pass; `clippy --all-targets -D warnings` and `cargo fmt` clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <noreply@anthropic.com>
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
rollout_schema()before WAL merge, adding missing nullable columns as all-null arraysscan_one_by_idandlsm_scanner_for_sourceread pathNoneTesting
cargo fmt --all -- --checkcargo clippy --workspace --all-targets -- -D warningscargo test -p lance-context-core -p lance-context-master --libcargo test -p lance-context-core --lib claim_check -- --nocapture