Skip to content
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: avoid setting ignoreNewTopologyRequestsEndTimeNano on initial connection #1221

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

aaron-congo
Copy link
Contributor

Description

  • fixes a bug where the failover2 plugin occasionally incorrectly threw a FailoverFailedSQLException. Before these changes, there was a chance that ignoreNewTopologyRequestsEndTimeNano would be set to a positive value on initial connection when the writer is first being verified. If failover occurred after initial connection but before this duration was over, the failover plugin's request for new topology would be ignored and the old cached topology returned instead. Since the old topology still indicated the old writer as the current writer, the failover plugin was incorrectly trying to connect to the old failed writer. This connection attempt would fail and the plugin would throw a FailoverFailedSQLException.
    • to address this problem, we now initialize ignoreNewTopologyRequestsEndTimeNano to a value of -1. The first time that the writer is verified (during initial connection), we set it to a value of 0. Any subsequent events where the writer is verified indicate successful failover, so ignoreNewTopologyRequestsEndTimeNano is updated to a positive value.
  • also fixed a bug where ignoreNewTopologyRequestsEndTimeNano was being set to a positive value before the topology was updated. This could result in topology requests returning stale incorrect topology if the request came in after ignoreNewTopologyRequestsEndTimeNano was set but before the topology was updated.
  • also added and cleaned up logs for the failover2 plugin to make future debugging easier

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link

Qodana Community for JVM

1 new problem were found

Inspection name Severity Problems
Unused assignment 🔶 Warning 1

💡 Qodana analysis was run in the pull request mode: only the changed files were checked

View the detailed Qodana report

To be able to view the detailed Qodana report, you can either:

  1. Register at Qodana Cloud and configure the action
  2. Use GitHub Code Scanning with Qodana
  3. Host Qodana report at GitHub Pages
  4. Inspect and use qodana.sarif.json (see the Qodana SARIF format for details)

To get *.log files or any other Qodana artifacts, run the action with upload-result option set to true,
so that the action will upload the files as the job artifacts:

      - name: 'Qodana Scan'
        uses: JetBrains/qodana-action@v2023.3.1
        with:
          upload-result: true
Contact Qodana team

Contact us at qodana-support@jetbrains.com

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.

1 participant