-
Notifications
You must be signed in to change notification settings - Fork 317
[5.1] Backport BAG failover fix. Ignore server provided failover partner. #3704
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
Conversation
* Add IgnoreServerProvidedFailoverPartner app context switch. * Add behavior skip to netfx. * Consolidate to single property for failover partner value. * Rework checks to preserve server provided value, but ignore it. * Fix import. * Skip server failover partner override in �LoginNoFailover method. Add simulated server test coverage.
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.
Pull Request Overview
This PR backports a fix from PR #3625 to the 5.1 branch that addresses Basic Availability Group (BAG) failover issues by adding an option to ignore server-provided failover partners. The implementation adds a new AppContext switch that allows applications to explicitly control failover behavior instead of relying on server-provided values.
Key Changes:
- Introduced
IgnoreServerProvidedFailoverPartnerAppContext switch to control failover partner behavior - Refactored
ServerProvidedFailOverPartnerproperty from a field-backed read-only property to an auto-property with consistent naming - Updated failover logic to conditionally use server-provided values based on the new switch
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| LocalAppContextSwitches.cs | Adds the new IgnoreServerProvidedFailoverPartner switch with documentation |
| SqlInternalConnectionTds.cs (netfx) | Refactors failover partner property and implements conditional logic based on the new switch |
| SqlInternalConnectionTds.cs (netcore) | Same changes as netfx version for .NET Core platform |
| SqlCommand.cs (netfx) | Updates property reference to use corrected naming |
| SqlCommand.cs (netcore) | Updates property reference to use corrected naming |
src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs
Show resolved
Hide resolved
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## release/5.1 #3704 +/- ##
===============================================
+ Coverage 71.82% 71.99% +0.16%
===============================================
Files 293 293
Lines 61659 61610 -49
===============================================
+ Hits 44289 44354 +65
+ Misses 17370 17256 -114
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
paulmedynski
left a comment
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 think these changes are risky without the accompanying tests.
src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs
Show resolved
Hide resolved
benrr101
left a comment
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.
Paul's comments are good - Since the overall approval is gated on his, I'll approve.
src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlConnectionBasicTests.cs
Show resolved
Hide resolved
|
@benrr101 @paulmedynski comments addressed and I backported the test included in the original PR. |
paulmedynski
left a comment
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.
Asking for one clarification.
Description
Backports #3625