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

   `JdbcCatalog` has four `InterruptedException` handlers. Three of them 
restore the interrupt status before rethrowing; `execute` does not.
   
   | | restores |
   | --- | --- |
   | `initializeCatalogTables` (:227) | yes |
   | `updateSchemaIfRequired` (:268) | yes |
   | **`execute` (:781)** | **no** |
   | `fetch` (:814) | yes |
   
   `execute` backs every write path — `dropTable`, `renameTable`, `renameView`, 
`dropNamespace` and the namespace property insert/update/delete — so a task 
cancelled while waiting for a pooled connection ends up with a thread whose 
interrupt status has been cleared by `Object.wait`. Anything downstream that 
polls `Thread.interrupted()` to decide whether to stop, including the executors 
Spark and Flink use to cancel work, sees a thread that was never interrupted.
   
   The fix is the same one line the other three handlers already have.
   
   ## Testing
   
   `TestJdbcCatalog.testExecuteRestoresInterruptStatus` builds a catalog with 
`clients=1`, holds the single pooled connection from another thread through the 
existing `@VisibleForTesting connectionPool()` accessor, interrupts the test 
thread, and asserts that `dropTable` both throws 
`UncheckedInterruptedException` and leaves the interrupt status set. It fails 
on `main` with `Expecting value to be true but was false` and passes with this 
change. Two latches rather than sleeps, so there is no timing window.
   
   One thing worth flagging for whoever reviews the test: it has to call 
`dropTable(ident, false)`. The single-argument `dropTable` defaults to `purge = 
true`, which reads table metadata through `fetch` first — and `fetch` already 
restores the status, so the assertion would pass even without the fix. The same 
trap applies to `dropNamespace` and the property setters.
   
   - `:iceberg-core:test --tests "org.apache.iceberg.jdbc.*"` — passes
   - `:iceberg-core:spotlessCheck` — passes
   


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