cjungm opened a new pull request, #19265:
URL: https://github.com/apache/iceberg/pull/19265

   Closes #19259
   
   Since #14940, `BigQueryTableOperations` keeps the `Table` loaded by 
`doRefresh()` and reuses it in `updateTable()`. That cached table is shared by 
every thread committing through the same `TableOperations` (for example 
`rewrite_data_files` workers with partial progress). `updateTable()` mutated it 
in place, so the PATCH of one commit could carry the `metadata_location` of 
another; the other commit then got a 412 and deleted the metadata file the 
catalog pointed to. The etag was also not tied to `base`, so after another 
thread's refresh a commit computed from stale metadata could pass the etag 
check, and a commit failed with `must be loaded during refresh before commit` 
while another thread's refresh had cleared the field.
   
   - `updateTable()` reads the cached table once and sends a per-commit copy 
instead of mutating it.
   - It throws `CommitFailedException` when the cached table's 
`metadata_location` is not `base.metadataFileLocation()`, the comparison this 
class made before #14940 and that Hive, Glue and JDBC make.
   - `doRefresh()` assigns the field once, after the table has been loaded.
   
   No BigQuery call is added, so the single load per commit from #14940 is kept.
   
   Test plan: three new tests in `TestBigQueryTableOperations` pin each 
interleaving with latches: two commits inside `update` at the same time, a 
commit while another thread's refresh has loaded a newer table, and a commit 
while another thread's refresh waits for BigQuery. Each fails on `main`. 
`:iceberg-bigquery:check` passes.
   
   ---
   **AI Disclosure**
   - Model: Claude Fable 5.1
   - Platform/Tool: Claude Code
   - Human Oversight: fully reviewed
   - Prompt Summary: Fix #19259 (concurrent commits sharing the table cached by 
`BigQueryTableOperations`); the fix, its tests and this description are 
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