feat(mem-wal): ShardWriter::abort + ShardStatus(Sealed) manifest fence for drop-table#7361
Open
hamersaw wants to merge 5 commits into
Open
feat(mem-wal): ShardWriter::abort + ShardStatus(Sealed) manifest fence for drop-table#7361hamersaw wants to merge 5 commits into
hamersaw wants to merge 5 commits into
Conversation
… drop-table Add two small primitives sophon's WAL drop-table teardown needs: - ShardWriter::abort(&self): shut down the background flush tasks without flushing, discarding buffered memtable state. Unlike close(self) it takes &self (callable through an Arc) and performs no object-store IO; the caller must quiesce writes first. Idempotent. - Session::invalidate_dataset(uri): evict a dataset's metadata- and index-cache entries via the existing prefix-invalidation primitive, scoped with a trailing slash so a sibling whose URI shares the prefix (t.lance vs t.lance2) is left untouched. On drop, abort keeps the flush task from re-creating files under a just-removed directory, and invalidate_dataset lets a same-URI recreate cold-read fresh state instead of stale cached manifests/indices. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
|
ACTION NEEDED The PR title and description are used as the merge commit message. Please update your PR title and description to match the specification. For details on the error please inspect the "PR Title Check" action. |
# Conflicts: # rust/lance/src/dataset/mem_wal/write.rs
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Remove the explicit cache-invalidation primitive added for WAL drop-table. Stale cached state for a dropped/recreated dataset URI can instead be left to ordinary Session cache eviction, so the dedicated method is unneeded. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Drop-table 2PC needs a durable, reversible in-doubt marker. Add a
ShardStatus { Active | Sealed } field to ShardManifest (proto + struct +
serde; preserved across claims via ..base, Active-defaulted at fresh
construction sites). claim_epoch refuses a Sealed manifest with a
distinguishable error instead of minting a new epoch, so a sealed shard
can't be resurrected even if a caller skips its own status check.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Covers the drop-table 2PC resurrection backstop: a Sealed manifest is refused with a distinguishable error (no new epoch minted), and rolling the status back to Active makes the shard claimable again. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
|
Important This PR touches the Lance format specification. Substantive changes to the format specification — the If this is a meaningful format change:
|
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.
What
The mem-wal primitives sophon's drop-table two-phase commit needs:
ShardWriter::abort(&self)— shut down the background flush tasks (task_executor.shutdown_all()) without flushing, discarding buffered memtable state. Unlikeclose(self)it takes&self(so it's callable through theArc<ShardWriter>callers hold) and does no object-store IO. The caller must quiesce writes first (documented). Idempotent. Acked data is not lost — it's durable in the WAL log and replays on the next claim, which is what makes the drop's prepare phase reversible.ShardStatus { Active | Sealed }onShardManifest— a durable, reversible lifecycle marker (proto + struct + serde).claim_epochrefuses aSealedmanifest with a distinguishable error instead of minting a new epoch, so a shard mid-drop can't be re-claimed — even by a caller that skips its own status check — and a reader can tell an in-doubt drop apart from an ordinary epoch fence. Set/cleared through the existing epoch-guardedcommit_updateCAS; carried across claims via..base, so only the genuinely-fresh constructions default it toActive.Why
A WAL-enabled table's drop spans two durable resources — the owning pod's fresh-tier state and the catalog/object-store data — so sophon's teardown is a two-phase commit. Before the dataset directory is removed, the owning pod must:
abortthe writer so its background flush task can't re-create_mem_wal/under the just-deleted directory (a gracefulclose()would flush it back), andSealedso the drop is in-doubt across a pod crash or a Maglev rehome — which the in-memory fence flag cannot survive. The seal is reversible (rollback clears it back toActive), making the prepare phase abortable without data loss.Both build on existing machinery (
shutdown_all, the manifest CAS) — thin exposure, not new infrastructure.Tests
test_abort_discards_without_flushing_and_is_idempotent—abortleaves no new L0 generation (contrast withclose), idempotent on a second call.test_claim_epoch_refuses_sealed_manifest— aSealedmanifest is refused with the distinguishable error and left untouched (no epoch minted); rolling the status back toActivemakes the shard claimable again (reversibility).🤖 Generated with Claude Code