Skip to content

Flink: Fix JdbcLockFactory to allow ClientPoolImpl connection retry (#15759)#16049

Open
yadavay-amzn wants to merge 1 commit intoapache:mainfrom
yadavay-amzn:fix/15759-jdbc-lock-retry
Open

Flink: Fix JdbcLockFactory to allow ClientPoolImpl connection retry (#15759)#16049
yadavay-amzn wants to merge 1 commit intoapache:mainfrom
yadavay-amzn:fix/15759-jdbc-lock-retry

Conversation

@yadavay-amzn
Copy link
Copy Markdown
Contributor

Summary

In JdbcLockFactory.JdbcLock, the instanceId() and unlock() methods caught SQLException inside the lambda passed to ClientPoolImpl.run() and wrapped it as UncheckedSQLException (a RuntimeException). This prevented ClientPoolImpl's retry mechanism from triggering because isConnectionException() checks for SQLException, not UncheckedSQLException.

Fix

Removed the inner try-catch blocks that wrapped SQLException as UncheckedSQLException inside the lambdas. The lambda signature for ClientPoolImpl.run() already declares throws Exception, so SQLException propagates naturally to ClientPoolImpl where the retry logic can detect connection exceptions and retry appropriately.

The outer catch (SQLException e) blocks remain to convert to UncheckedSQLException after ClientPoolImpl has exhausted its retry attempts.

Closes #15759

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flink Maintenance: JdbcLockFactory inner catch blocks prevent ClientPoolImpl connection retry mechanism from working

1 participant