paimon icon indicating copy to clipboard operation
paimon copied to clipboard

[Feature] Share BTree SST block cache across scans and avoid invalidating on close

Open tzphh opened this issue 13 hours ago • 0 comments

Search before asking

  • [x] I searched in the issues and found nothing similar.

Motivation

On master (055fe60215), repeated point lookups on large B-Tree SST files repeatedly read index/data blocks from remote storage because:

  1. BTreeGlobalIndexer (BTreeGlobalIndexer.java:102-109) creates a new private CacheManager per instance, preventing cache reuse across scans.
  2. BlockCache.close() (BlockCache.java:100-102) unconditionally calls cacheManager.invalidFile(filePath), immediately evicting all blocks loaded by BTreeIndexReader.
  3. BTreeIndexReader eagerly opens the underlying SeekableInputStream even when blocks could be served from cache.

Solution

  1. Support sharing a bounded CacheManager across BTreeGlobalIndexer scans (keyed by cache size / high-priority ratio).
  2. Allow BlockCache to skip invalidFile(filePath) on close() when backed by a shared cache (committed B-Tree SST files are immutable).
  3. Open the underlying SeekableInputStream lazily only on cache miss.

Anything else?

No response

Are you willing to submit a PR?

  • [x] I'm willing to submit a PR!

tzphh avatar Dec 04 '26 06:12 tzphh