-
Notifications
You must be signed in to change notification settings - Fork 54
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
fix: issues with custom domains during failover #1265
Conversation
Qodana Community for JVM1 new problem were found
💡 Qodana analysis was run in the pull request mode: only the changed files were checked View the detailed Qodana reportTo be able to view the detailed Qodana report, you can either:
To get - name: 'Qodana Scan'
uses: JetBrains/[email protected]
with:
upload-result: true Contact Qodana teamContact us at [email protected]
|
be6deb0
to
9e3756e
Compare
wrapper/src/main/java/software/amazon/jdbc/plugin/AuroraConnectionTrackerPlugin.java
Outdated
Show resolved
Hide resolved
wrapper/src/main/java/software/amazon/jdbc/plugin/AuroraConnectionTrackerPlugin.java
Outdated
Show resolved
Hide resolved
wrapper/src/main/java/software/amazon/jdbc/plugin/AuroraConnectionTrackerPlugin.java
Outdated
Show resolved
Hide resolved
wrapper/src/main/java/software/amazon/jdbc/plugin/AuroraConnectionTrackerPlugin.java
Outdated
Show resolved
Hide resolved
wrapper/src/main/java/software/amazon/jdbc/plugin/AuroraConnectionTrackerPlugin.java
Outdated
Show resolved
Hide resolved
wrapper/src/main/java/software/amazon/jdbc/plugin/OpenedConnectionTracker.java
Show resolved
Hide resolved
wrapper/src/main/java/software/amazon/jdbc/plugin/OpenedConnectionTracker.java
Outdated
Show resolved
Hide resolved
wrapper/src/main/java/software/amazon/jdbc/plugin/OpenedConnectionTracker.java
Show resolved
Hide resolved
wrapper/src/main/java/software/amazon/jdbc/plugin/OpenedConnectionTracker.java
Outdated
Show resolved
Hide resolved
wrapper/src/main/java/software/amazon/jdbc/plugin/failover/FailoverConnectionPlugin.java
Show resolved
Hide resolved
4cc2f79
to
9f64d7d
Compare
fix the issue when the current connection is invalidated fix issue with custom domains during failover
9f64d7d
to
08e31c1
Compare
wrapper/src/main/java/software/amazon/jdbc/plugin/AuroraConnectionTrackerPlugin.java
Outdated
Show resolved
Hide resolved
wrapper/src/main/java/software/amazon/jdbc/plugin/AuroraConnectionTrackerPlugin.java
Outdated
Show resolved
Hide resolved
&& !this.closedExplicitly.get() | ||
&& this.pluginService.getCurrentConnection() != null | ||
&& this.pluginService.getCurrentConnection().isClosed()) { | ||
this.pickNewConnection(); |
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.
Can we add a log here seeing as this is a bit of a special scenario? Also, should we add a configuration parameter to enable/disable this? Not sure if some customers might prefer to error out if they end up executing against a closed connection.
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.
I realize that hostListRefreshThresholdTimeNano may change since it is static but I don't understand why we set it to 0 in the compareAndSet call if it hasn't changed in the last few lines of code. Why does that mean we should clear the value?
I added comments to the code. I hope it adds clarity. The code sets a time value to hostListRefreshThresholdTimeNano when it's necessary to keep refreshing host list. When the specified time is reached, we reset hostListRefreshThresholdTimeNano to zero and deactivates further host list refreshes.
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.
Should we log here seeing as this is a bit of a special scenario? Also, should we add a configuration parameter to enable/disable this? Not sure if some customers might prefer to error out if they end up executing against a closed connection.
Failover code has necessary logging so I believe it provides enough details for troubleshooting. I don't think that user has a choice here. Without failover in this case, user (most probably) gets an error executing JDBC call on closed connection. With this code, user may get a chance to failover and proceed with JDBC call successfully.
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.
Right, I was thinking that for customer logs it might be helpful to know that failover was kicked off because of executing against a closed connection which may be different than executing against a network-failed connection. Up to you though.
wrapper/src/main/java/software/amazon/jdbc/plugin/AuroraConnectionTrackerPlugin.java
Outdated
Show resolved
Hide resolved
wrapper/src/main/java/software/amazon/jdbc/plugin/AuroraConnectionTrackerPlugin.java
Outdated
Show resolved
Hide resolved
&& !this.closedExplicitly.get() | ||
&& this.pluginService.getCurrentConnection() != null | ||
&& this.pluginService.getCurrentConnection().isClosed()) { | ||
this.pickNewConnection(); |
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.
Right, I was thinking that for customer logs it might be helpful to know that failover was kicked off because of executing against a closed connection which may be different than executing against a network-failed connection. Up to you though.
Summary
Fix issue with custom domains during failover
verifyOpenedConnectionType
Additional Reviewers
@karenc-bq
@aaron-congo
@aaronchung-bitquill
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.