feat(mem-wal): ShardWriter::abort and Session::invalidate_dataset for drop-table#7361
Open
hamersaw wants to merge 1 commit into
Open
feat(mem-wal): ShardWriter::abort and Session::invalidate_dataset for drop-table#7361hamersaw wants to merge 1 commit into
hamersaw wants to merge 1 commit 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. |
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
Two small mem-wal primitives that sophon's WAL drop-table teardown 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 can be called through theArc<ShardWriter>callers hold) and performs no object-store IO. The caller must quiesce writes first (documented). Idempotent.Session::invalidate_dataset(uri)— evict a dataset's metadata- and index-cache entries via the existingLanceCache::invalidate_prefixprimitive, scoped with a trailing slash ("{uri}/") so a sibling whose URI shares the prefix (t.lancevst.lance2) is left untouched.Why
When a WAL-enabled table is dropped, the owning pod must tear down its in-memory
ShardWriterbefore the dataset directory is removed:abortkeeps the background flush task from re-creating_mem_wal/files under a just-deleted directory (a gracefulclose()would flush them back).invalidate_datasetlets a same-name/same-URI recreate cold-read fresh state instead of serving the dropped incarnation's cached manifests/indices from the sharedSession.Both build on machinery that already exists (
shutdown_all,invalidate_prefix, per-dataset URI cache prefixing); this is a 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_invalidate_dataset_clears_only_that_uri— clears the target dataset's metadata + index entries while leaving a prefix-sharing sibling intact (guards the trailing-slash scoping).🤖 Generated with Claude Code