JingsongLi commented on PR #1410: URL: https://github.com/apache/paimon-rust/pull/1410#issuecomment-6910379720
Please align the REST catalog's cache lifecycle with Java alongside this direct-builder fix. The new fallback in [`FileIOBuilder::build()`](https://github.com/apache/paimon-rust/blob/e1c16f81525e8794da32e97df68f591b86368896/crates/paimon/src/io/file_io.rs#L1362-L1368) also affects catalog-created FileIOs. `RESTCatalog::new()` creates its cache from the original client options, but table FileIO builders receive the server-merged options. If `/v1/config` supplies `local-cache.enabled=true` and `local-cache.max-size=1 MiB`, while the client supplies no cache options, the catalog keeps `local_cache=None` and every `get_table()` now creates a separate memory cache. Each retained table handle can independently consume the configured limit, rather than sharing one catalog-level budget. A focused test loading the same table twice through a mocked REST catalog reproduced separate cache instances on this PR; restoring the baseline builder made the test pass. Java handles this consistently: [`RESTCatalog` creates one manager from the merged `api.options()`](https://github.com/apache/paimon/blob/8ad61142f3f110229f5ab7ec693b1ccb67507fe4/paimon-core/src/main/java/org/apache/paimon/rest/RESTCatalog.java#L131-L141), then [passes that manager to each table's FileIO wrapper](https://github.com/apache/paimon/blob/8ad61142f3f110229f5ab7ec693b1ccb67507fe4/paimon-core/src/main/java/org/apache/paimon/rest/RESTCatalog.java#L1640-L1647). [`wrapWithCachingIfNeeded()` returns the underlying FileIO when the manager is null](https://github.com/apache/paimon/blob/8ad61142f3f110229f5ab7ec693b1ccb67507fe4/paimon-common/src/main/java/org/apache/paimon/fs/cache/CachingFileIO.java#L98-L118), without constructing another cache from properties. Sharing here concerns the manager and capacity budget; wrapper namespaces remain isolated. Please initialize the Rust REST catalog cache once from the final merged options and preserve the catalog's explicit cache decision when constructing table FileIOs. The property-based fallback can still serve direct `FileIOBuilder` callers. A regression test with server-provided cache defaults and repeated table loads should verify that the cache and its budget stay shared. -- 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]
