-
Notifications
You must be signed in to change notification settings - Fork 317
[6.1] Backport BAG failover fix. Ignore server provided failover partner. #3702
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
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 BAG (Basic Availability Group) failover fix from #3625 to the 6.1 branch. The primary change introduces an AppContext switch IgnoreServerProvidedFailoverPartner that allows applications to ignore failover partner information provided by SQL Server, enabling explicit control over failover behavior (e.g., when using custom ports).
Key changes:
- Added new
IgnoreServerProvidedFailoverPartnerAppContext switch with default value offalse - Renamed
ServerProvidedFailOverPartnertoServerProvidedFailoverPartnerfor consistent casing throughout the codebase - Modified failover logic to respect the new switch when updating pool group failover partner designations
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/LocalAppContextSwitches.cs | Added new AppContext switch property and documentation, fixed typo "regardsless" → "regardless" |
| src/Microsoft.Data.SqlClient/tests/Common/LocalAppContextSwitchesHelper.cs | Extended test helper to support the new IgnoreServerProvidedFailoverPartner switch |
| src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs | Refactored failover partner property, implemented switch-aware failover logic, updated all references to use consistent casing |
| src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs | Applied same failover partner changes as netfx version for cross-platform consistency |
| src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlCommand.cs | Updated property reference to use corrected casing |
| src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlCommand.cs | Updated property reference to use corrected casing |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## release/6.1 #3702 +/- ##
===============================================
+ Coverage 67.50% 70.16% +2.66%
===============================================
Files 279 279
Lines 61750 61764 +14
===============================================
+ Hits 41685 43338 +1653
+ Misses 20065 18426 -1639
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:
|
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.
Some discrepancies between this and the other ports...
src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs
Show resolved
Hide resolved
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.
Where are the new tests?
* 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.
c2fb0e0 to
1573736
Compare
|
I reapplied the cherry-pick and force pushed. This diff should hopefully be cleaner. |
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.
Happy to approve if that one comment is expected behavior
src/Microsoft.Data.SqlClient/tests/Common/LocalAppContextSwitchesHelper.cs
Show resolved
Hide resolved
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
f3b7349
Description
Backports #3625