[WIP] feat(manifest): support snapshot mainifest cache#386
Draft
gripleaf wants to merge 1 commit into
Draft
Conversation
9b7c737 to
8337c3b
Compare
8337c3b to
5280b8e
Compare
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.
Purpose
In our production workload, a Paimon table may have about 60k buckets. A batch of data is imported roughly every 15 minutes, and the interval may become longer. During query planning, one scan read and decoded about 4.89 million manifest entries with 16 threads, which took around 30 seconds, while only a small subset of entries was finally kept after pruning.
This patch introduces a snapshot-level live manifest cache to reduce repeated manifest read and decode cost. The cache stores merged live manifest entries for snapshots. When scanning a newer snapshot, paimon-cpp looks up the latest cached snapshot not greater than the target snapshot. If it is the same snapshot, the scan can use it directly; otherwise paimon-
cpp incrementally builds the target snapshot by reading intermediate delta manifests.
The implementation reuses the existing byte-oriented
Cacheinterface:CacheKind::SNAPSHOT_LIVE_MANIFEST;table_path#branchas the logical cache key;scan.manifest-entry-cache.max-snapshots;ScanContextBuilder::WithCache()andscan.manifest-entry-cache.max-snapshotsis greater than 0.This trades one in-memory serialize/deserialize path for avoiding remote manifest reads plus manifest decoding. In the expected case, live entries are much fewer than all historical manifest entries; even in a conservative case, the cache is useful as long as deserializing cached live entries is cheaper than reading manifest files from remote storage and
decoding all required manifest entries again.
Tests
cmake --build build --target paimon-core-test -j2./build/release/paimon-core-test --gtest_filter='FileStoreScanTest.TestSnapshotLiveManifestCache:FileStoreScanTest.TestSnapshotLiveManifestCacheUsesCacheKey:TableScanTest.*:CoreOptionsTest.TestDefaultValue:CoreOptionsTest.TestFromMap:CoreOptionsTest.TestInvalidCase'git -c filter.lfs.process= -c filter.lfs.clean=cat -c filter.lfs.required=false diff --checkAPI and Format
This change extends the public cache kind enum with
CacheKind::SNAPSHOT_LIVE_MANIFEST.It removes the separate
scan.manifest-entry-cache.enabledoption. The cache is controlled byscan.manifest-entry-cache.max-snapshots: values greater than 0 enable the cache path when a cache is provided throughWithCache(), and 0 disables it.It does not change table storage format, file format, or network protocol. The serialized snapshot live manifest bundle is an in-memory cache value only and can be rebuilt from manifest files if absent or evicted.
Documentation
Yes. Added/updated user guide documentation for snapshot live manifest cache under
docs/source/user_guide/manifest_entry_cache.rst.Generative AI tooling
Generated-by: Codex (GPT-5)