ysung opened a new pull request, #17388: URL: https://github.com/apache/iceberg/pull/17388
## Summary - prevent `CachingCatalog` from returning a stale table after a concurrent commit - retry table loads that overlap cache invalidation or expiration without mutating the cache from a Caffeine mapping callback - preserve specialized table behavior, including REST server-side scan planning, when replacing table operations ## Root cause After a cached table expires, one thread can reload and cache a second pre-commit table while another thread still holds the original table and commits through it. Updating only the committing table's operations leaves the newly cached table stale. Metadata-table loads can race with invalidation in a similar way. Fixing this with nested cache mutation from inside `compute`/`get` would reintroduce the deadlock and recursive-update risk from #3791. ## Approach `CachingCatalog` now: - tracks bounded per-key generations around invalidation and commit - retries loads that span a generation change - invalidates after a successful commit only when another cached table replaced the committing table - invalidates conservatively for `CommitStateUnknownException` - replaces operations through an explicit table capability so specialized table implementations retain their behavior No mapping callback mutates the same cache. ## Validation - `./gradlew :iceberg-core:test` - `./gradlew :iceberg-core:spotlessCheck` - `./gradlew :iceberg-core:revapi` - focused REST scan-planning regression test Closes #17338 --- **AI Disclosure** - Model: GPT-5 - Platform/Tool: Codex - Human Oversight: partially reviewed - Prompt Summary: Design and implement a race-safe `CachingCatalog` fix that avoids nested Caffeine cache mutation and preserves table subtype behavior. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
