-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to define multiple retry strategies for JDBC connection #20860
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense.
Have we considered making this apply to JdbcRecordCursor
too sometime? Currently retries only save us when opening connections.
IIRC @wendigo ran into a case where reading results can fail because of connection being closed due to being idle for long time (e.g. table scan in join query waiting for other table scan).
LGTM. The questions above are to start a discussion only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like an almost exact copy of the PR I left behind when we discussed it here:
https://github.com/trinodb/trino/pull/20132/files
I believe you are closer to the context, as I was writing the code 2 months ago. For me it looks good to go, but you can cross check yourself against that WiP PR whether you didn't miss anything.
what irony is this, test failed because of
|
Does it mean that retry didn't work? |
We did and the conclusion was that retrying during the read/write is complex. So it is out of the scope now. |
indeed looks like retry didn't work for some reason.
You might want to log the |
plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/RetryingConnectionFactory.java
Outdated
Show resolved
Hide resolved
4ce9956
to
477b3bd
Compare
Retrying works. I had to be very unlucky last time. |
Please take a look at the new second commit. |
Logging logging = Logging.initialize(); | ||
logging.setLevel(RetryingConnectionFactory.class.getName(), DEBUG); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this useful? I don't think anyone would see the logs unless they explicitly go looking for it.
Since you've already proved retries work (since it was logged in current CI run) maybe we can remove this.
Let's keep the log.debug
in the connection factory though - useful to have.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks to that now Oracle connector will retry opening a JDBC connection on any SQLRecoverableException or SQLTransientException. Previously it retried only on the former.
477b3bd
to
6e9635e
Compare
I dropped the second commit. |
Allow to define multiple retry strategies for JDBC connection
Thanks to that now Oracle connector will retry opening a JDBC connection on
any SQLRecoverableException or SQLTransientException. Previously it
retried only on the former.