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: issues with custom domains during failover #1265

Merged
merged 4 commits into from
Feb 6, 2025

Conversation

sergiyvamz
Copy link
Contributor

@sergiyvamz sergiyvamz commented Jan 29, 2025

Summary

Fix issue with custom domains during failover

  • In case of connections are opened with a custom domain they are not invalidated during failover
  • Fix various issues with tracked connections and custom domains
  • Improved verification of tracked connection; Already closed tracked connections are removed.
  • Added new configuration parameters 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.

Copy link

github-actions bot commented Jan 30, 2025

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/[email protected]
        with:
          upload-result: true
Contact Qodana team

Contact us at [email protected]

@sergiyvamz sergiyvamz force-pushed the fix-failover-with-custom-domain branch 2 times, most recently from be6deb0 to 9e3756e Compare January 30, 2025 15:26
@sergiyvamz sergiyvamz force-pushed the fix-failover-with-custom-domain branch from 4cc2f79 to 9f64d7d Compare February 4, 2025 19:07
fix the issue when the current connection is invalidated
fix issue with custom domains during failover
&& !this.closedExplicitly.get()
&& this.pluginService.getCurrentConnection() != null
&& this.pluginService.getCurrentConnection().isClosed()) {
this.pickNewConnection();
Copy link
Contributor

@aaron-congo aaron-congo Feb 5, 2025

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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.

&& !this.closedExplicitly.get()
&& this.pluginService.getCurrentConnection() != null
&& this.pluginService.getCurrentConnection().isClosed()) {
this.pickNewConnection();
Copy link
Contributor

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.

@karenc-bq karenc-bq changed the title fix issue with custom domains during failover fix: issues with custom domains during failover Feb 6, 2025
@sergiyvamz sergiyvamz merged commit 85e1b3c into main Feb 6, 2025
6 checks passed
@sergiyvamz sergiyvamz deleted the fix-failover-with-custom-domain branch February 6, 2025 15:53
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.

3 participants