-
Notifications
You must be signed in to change notification settings - Fork 49
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: various reader failover fixes #1227
base: main
Are you sure you want to change the base?
Conversation
Qodana Community for JVMIt seems all right 👌 No new problems were found according to the checks applied 💡 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]
|
wrapper/src/main/java/software/amazon/jdbc/plugin/failover/FailoverConnectionPlugin.java
Outdated
Show resolved
Hide resolved
wrapper/src/main/java/software/amazon/jdbc/plugin/failover2/FailoverConnectionPlugin.java
Outdated
Show resolved
Hide resolved
…g that they have READER role
initHostProviderFunc.call(); | ||
} | ||
|
||
@Override | ||
public OldConnectionSuggestedAction notifyConnectionChanged(final EnumSet<NodeChangeOptions> changes) { |
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.
this function has the same implementation in the superclass so I removed it
@@ -578,22 +567,6 @@ protected void failover(final HostSpec failedHost) throws SQLException { | |||
} else { | |||
failoverReader(failedHost); | |||
} | |||
|
|||
if (isInTransaction || this.pluginService.isInTransaction()) { |
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.
This was moved to throwFailoverSuccessException so that the exception is thrown in failoverReader/failoverWriter instead. This was needed because failoverReader/failoverWriter catch the exception and then update the telemetry context, but there was a bug where we the exception was thrown here instead of in failoverReader/failoverWriter.
@@ -621,28 +593,24 @@ protected void failoverReader(final HostSpec failedHostSpec) throws SQLException | |||
} | |||
|
|||
if (result == null || !result.isConnected()) { | |||
// "Unable to establish SQL connection to reader instance" | |||
processFailoverFailure(Messages.get("Failover.unableToConnectToReader")); | |||
this.failoverReaderFailedCounter.inc(); |
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.
there was a bug here and other places where the failover failed counter was incorrectly increased twice, once here and once in the catch section for this block
@@ -442,43 +430,7 @@ void test_execute_withDirectExecute() throws SQLException { | |||
|
|||
private void initializePlugin() { | |||
plugin = new FailoverConnectionPlugin(mockPluginService, properties); | |||
} | |||
|
|||
private static class FooHostListProvider implements HostListProvider, DynamicHostListProvider { |
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.
This class was not being used so I removed it
Description
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.