binarybrain-009 opened a new pull request, #18683:
URL: https://github.com/apache/iceberg/pull/18683

   Catalogs that share cached `TableMetadata` across threads, such as the REST 
catalog's table cache, also share its snapshots and schemas, whose lazily 
initialized fields are written without synchronization. Another thread can then 
see a collection before its contents: `BaseSnapshot` publishes the manifest 
list as an `ArrayList`, and `Schema` its ID index and accessors as `HashMap`s. 
These fields are now volatile and initialized under the object's monitor, as in 
`PartitionSpec` and `TableMetadata`. `BaseSnapshot` locks in its cache methods, 
like `ensureSnapshotsLoaded`, rather than in each accessor, so concurrent first 
calls read the manifest list once. Refreshes the stale #17586. 
apache/polaris#5328 caches raw JSON instead of parsed metadata because of this 
issue.
   
   Test plan: visibility races can't be reproduced deterministically, so there 
is no new test, as with the same fix for `PartitionSpec` (#219); the existing 
api and core suites pass.
   
   Fixes #17585
   
   ---
   **AI Disclosure**
   - Model: Claude Opus 5.5
   - Platform/Tool: Claude Code
   - Human Oversight: fully reviewed
   - Prompt Summary: Fix the unsynchronized lazy initialization in BaseSnapshot 
and Schema reported in #17585, refreshing the stale #17586; the code change is 
generated
   


-- 
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]

Reply via email to