feat(namespace): add in-memory directory manifest cache mode - #9588
Closed
ChilePiquin wants to merge 1 commit into
Closed
ChilePiquin wants to merge 1 commit into
ChilePiquin wants to merge 1 commit into
Conversation
ChilePiquin
marked this pull request as ready for review
September 28, 2026 14:17
ChilePiquin
force-pushed
the
bruno/manifest-cache-in-memory
branch
from
September 28, 2026 15:29
417682e to
f79fdfc
Compare
ChilePiquin
force-pushed
the
bruno/manifest-cache-in-memory
branch
from
September 28, 2026 16:17
f79fdfc to
e33a9eb
Compare
Contributor
There was a problem hiding this comment.
✅ Gate recommendation: approve.
The opt-in snapshot mode now has a consistent read-only boundary. Catalog writes fail before the write-manifest cell is initialized, and direct table mutations fail before using cached locations. The new regressions cover both previously reported failures.
Please mark this PR with the breaking-change label.
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.
Directory namespace manifest reads currently re-check the manifest dataset and run filtered scans for repeated lookup/list operations. That is the right default for long-lived readers, but it is expensive for callers that intentionally operate on a fixed namespace snapshot and issue many reads over the same manifest. This PR adds an opt-in
manifest_cache_mode=in_memorysetting for directory namespaces. In this mode, a namespace instance loads the__manifestrows once and serves supported manifest reads from that pinned in-memory snapshot; a new namespace instance observes newer commits. Because cached snapshots can become stale,in_memoryis a read-only mode: namespace/table mutations are rejected before they can validate write preconditions against old manifest state or mutate a table resolved from a stale location.This was accomplished with the following changes:
DirectoryNamespaceBuildernow carriesmanifest_cache_mode, parses it from properties, and exposes amanifest_cache_mode(...)builder method.ManifestCacheModeindir/manifest.rsdefines the supported values,noneandin_memory, with validation for invalid property values.DatasetConsistencyWrappernow storesManifestDatasetState, including the manifestDataset, optionalManifestSnapshot, and cache mode.ManifestSnapshotloads the manifest columns needed for namespace reads into sorted in-memory rows for binary lookup and direct-child iteration.ManifestNamespaceuses the snapshot fast path for manifest containment checks, table/namespace lookup, root table locations, table listing, namespace listing, and namespace-empty checks.DirectoryNamespacerejectsin_memorywrites before initializing the write-manifest cell, preserving the pinned read snapshot even after failed writes.in_memorynamespace instances before mutating state.set_latest, preserving the existing writer behavior for uncached namespace instances that mutate the manifest.Testing
Added coverage for parsing
manifest_cache_mode, rejecting invalid values, preserving the defaultnonebehavior, verifying that anin_memorynamespace instance pins its manifest snapshot, and confirming cached namespace instances cannot orphan children, mutate data after deregistration, change their pinned view after a failed write, or perform writes.Verified with:
cargo test -p lance-namespace-impls manifest_cache_mode --no-default-features --quietcargo test -p lance-namespace-impls in_memory_manifest_cache --no-default-features --quietcargo check -p lance-namespace-impls --no-default-features --quiet