feat(compaction): support lru cache#210
Merged
Merged
Conversation
lxy-9602
reviewed
Apr 6, 2026
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR introduces an LRU-based caching layer for lookup/compaction and adds per-SST reader block caching to improve read performance, replacing the prior no-op cache behavior.
Changes:
- Added an
LruCacheimplementation and wired it intoCacheManager(including index/data cache split support). - Plumbed
CacheManagerthrough lookup/compaction and SST reader paths; added new CoreOptions for cache sizing. - Added unit tests for
LruCacheandBlockCache, and updated existing tests for new APIs.
Reviewed changes
Copilot reviewed 34 out of 34 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/paimon/common/io/cache/cache.h | Reworked cache API; added eviction callback and size query; removed NoCache. |
| src/paimon/common/io/cache/cache_manager.{h,cpp} | Implemented cache manager backed by LruCache and added eviction callback wiring. |
| src/paimon/common/io/cache/lru_cache.{h,cpp} | New LRU cache implementation with weight-based eviction. |
| src/paimon/common/sst/block_cache.h | Updated block cache to use shared CacheManager, local hot map, and eviction callback syncing. |
| src/paimon/common/sst/sst_file_reader.{h,cpp} | Added CacheManager to reader creation, enabling per-reader block cache. |
| src/paimon/common/sst/sst_file_writer.{h,cpp} | Updated writer ctor signature/field ordering to match new call sites. |
| src/paimon/common/lookup/lookup_store_factory.{h,cpp} | Factory now receives CacheManager and passes it into SST readers. |
| src/paimon/common/lookup/sort/sort_lookup_store_factory.{h,cpp} | Stores CacheManager and threads it into reader creation. |
| src/paimon/core/core_options.{h,cpp} | Added options parsing/getters for lookup cache memory and high-priority pool ratio. |
| include/paimon/defs.h / src/paimon/common/defs.cpp | Added option keys for lookup cache configuration. |
| src/paimon/core/mergetree/compact/merge_tree_compact_manager_factory.{h,cpp} | Plumbed CacheManager into lookup levels creation. |
| src/paimon/core/operation/abstract_file_store_write.{h,cpp} | Instantiates and stores a CacheManager from CoreOptions. |
| src/paimon/core/operation/key_value_file_store_write.cpp | Passes cache_manager_ into compaction manager factory. |
| src/paimon/CMakeLists.txt | Added new cache sources/tests; removed old cache.cpp. |
| src/paimon/common/io/cache/lru_cache_test.cpp | New tests for LruCache behavior and concurrency. |
| src/paimon/common/sst/block_cache_test.cpp | New tests for block cache eviction/refresh/index-data split behavior. |
| Various *_test.cpp | Updated tests to use new factory/reader signatures and new options. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
lucasfang
reviewed
Apr 8, 2026
lxy-9602
reviewed
Apr 8, 2026
lxy-9602
reviewed
Apr 8, 2026
lxy-9602
reviewed
Apr 8, 2026
f228280 to
2eb40f6
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
(1) Remove NoCache, support LruCache in cache manager for global cache.
(2) Support block cache for each sst reader to improve read performance.
Linked issue: #93
Tests
block_cache_test.cpp
lru_cache_test.cpp