XiaoHongbo-Hope opened a new pull request, #1497: URL: https://github.com/apache/paimon-rust/pull/1497
## Summary Reuse opened BTree global-index readers across scans of the same `Table` handle. This avoids reopening immutable index files and rereading their footer and index block on repeated descriptor queries. - Key the cache by resolved index path and key type, since the reader owns a type-specific comparator. - Budget idle reader metadata using estimated retained bytes (128 MiB default) with LRU eviction. Share one separately bounded BTree data-block cache using the existing `btree-index.cache-size` setting; clear idle readers when that setting changes. - Keep readers exclusive while a scan uses them. Table copies share the cache; query-authorization scans retain scan-local readers. - Invalidate idle readers when REST data-token generation changes and reject readers returned by an older in-flight scan. Custom FileIO providers opt in by reporting a credential generation; other providers retain scan-local readers. There is no arbitrary five-minute expiration. ## Validation - `cargo test -p paimon --lib test_btree_reader_cache -- --nocapture` - `cargo test -p paimon --lib test_initial_token_skips_first_request_and_still_refreshes -- --nocapture` - `cargo fmt --all --check` - `git diff --check` ## Performance context The [archived five-seed descriptor benchmark](https://code.alibaba-inc.com/paimon/xrobot/blob/codex/q3-clip-full-bytes-20261121/experiments/customer-q3-real-images-20261119/clip-full-bytes-20261121/DESCRIPTOR16_DIRECT_READER_CACHE_AUDIT.md) identified repeated BTree reader opens as the main 16-clip warm-read cost. Its experimental candidate lowered median warm query time from 113 ms to 45 ms; indexed Lance measured 57 ms. That wheel also contained other unmerged optimizations, so those numbers motivate this isolated change rather than measure this PR on its own. ## Assumptions and limits This is an AI-assisted change. It assumes index-file paths identify immutable contents. The 128 MiB reader budget uses an estimate of retained heap bytes; opaque storage-reader allocations are not measured. A query already using a reader when credentials expire has the same in-flight behavior as before this PR. The isolated PR has not yet been remeasured on the ECS workload. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
