bharos opened a new issue, #17829:
URL: https://github.com/apache/iceberg/issues/17829

   ### Apache Iceberg version
   
   1.11.0 (latest release)
   
   ### Query engine
   
   Other
   
   ### Please describe the bug 🐞
   
   When a MySQL-backed `JdbcCatalog` connection is dropped by the server (for 
example an idle connection closed at `wait_timeout`), the pool does not recover 
it:
   
   ```
   UncheckedSQLException: Failed to execute exists query: SELECT ... FROM 
iceberg_tables ...
     Caused by: com.mysql.cj.jdbc.exceptions.CommunicationsException: 
Communications link failure
       Caused by: java.net.SocketException: Broken pipe
   ```
   
   The failure does not clear on the next call. `ClientPoolImpl.release` 
returns the client with `addFirst`, so the dead connection goes back to the 
head of the pool and is handed to the next caller.
   
   `JdbcClientPool` already reconnects on connection failures, but only for 
`SQLTransientException` and the SQLSTATEs in 
`COMMON_RETRYABLE_CONNECTION_SQL_STATES`. MySQL's `CommunicationsException` 
extends `SQLRecoverableException` — a sibling of `SQLTransientException`, not a 
subtype — and reports SQLSTATE `08S01`, which is not in that set. Neither check 
matches, so no reconnect is attempted.
   
   Same symptom as #14317.
   
   Proposed fix: treat `SQLRecoverableException` as retryable. The JDBC 
contract for that type is that recovery requires closing the connection and 
obtaining a new one, which is what `JdbcClientPool.reconnect` does. Adding 
`08S01` to the default SQLSTATEs would fix MySQL only.
   
   On existing releases, `retryable_status_codes=08S01` works as a workaround.
   
   PR: #17828
   


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