Skip to content

feat(compaction): support lru cache#210

Merged
lszskye merged 20 commits into
alibaba:mainfrom
lszskye:add_pk_compaction_e2e_test
Apr 8, 2026
Merged

feat(compaction): support lru cache#210
lszskye merged 20 commits into
alibaba:mainfrom
lszskye:add_pk_compaction_e2e_test

Conversation

@lszskye
Copy link
Copy Markdown
Collaborator

@lszskye lszskye commented Apr 3, 2026

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

Comment thread src/paimon/common/io/cache/cache.h
Comment thread src/paimon/common/sst/block_cache.h Outdated
Comment thread src/paimon/common/sst/block_cache.h
Comment thread src/paimon/common/sst/sst_file_reader.cpp
Comment thread src/paimon/core/core_options.cpp Outdated
Comment thread src/paimon/core/core_options.cpp
Comment thread src/paimon/common/sst/block_cache_test.cpp Outdated
Comment thread src/paimon/common/io/cache/cache_manager.h
Comment thread src/paimon/common/sst/block_cache_test.cpp Outdated
@zjw1111 zjw1111 requested a review from Copilot April 7, 2026 08:50
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 LruCache implementation and wired it into CacheManager (including index/data cache split support).
  • Plumbed CacheManager through lookup/compaction and SST reader paths; added new CoreOptions for cache sizing.
  • Added unit tests for LruCache and BlockCache, 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.

Comment thread src/paimon/common/sst/block_cache.h
Comment thread src/paimon/common/io/cache/lru_cache.cpp Outdated
Comment thread src/paimon/common/sst/block_cache_test.cpp
Comment thread src/paimon/common/sst/block_cache_test.cpp
Comment thread src/paimon/common/io/cache/lru_cache_test.cpp
Comment thread src/paimon/core/core_options.cpp
Comment thread src/paimon/common/io/cache/lru_cache.cpp Outdated
lxy-9602 and others added 3 commits April 7, 2026 17:21
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Comment thread src/paimon/common/io/cache/lru_cache.cpp
Comment thread src/paimon/common/io/cache/lru_cache.cpp
Comment thread src/paimon/common/io/cache/lru_cache.cpp
Comment thread src/paimon/common/io/cache/lru_cache.cpp Outdated
@lszskye lszskye force-pushed the add_pk_compaction_e2e_test branch from f228280 to 2eb40f6 Compare April 8, 2026 08:56
Copy link
Copy Markdown
Collaborator

@lucasfang lucasfang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@lszskye lszskye merged commit 78a980f into alibaba:main Apr 8, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants