-
Notifications
You must be signed in to change notification settings - Fork 317
[6.0] Backport BAG failover fix. Ignore server provided failover partner. #3703
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 fix for Basic Availability Group (BAG) failover behavior by introducing an AppContext switch that allows applications to ignore server-provided failover partners. This enables applications to maintain explicit control over failover configuration (e.g., using custom ports) instead of automatically accepting server-suggested partners.
Key changes include:
- Added a new
IgnoreServerProvidedFailoverPartnerAppContext switch with documentation - Refactored
ServerProvidedFailoverPartnerfrom a private field with getter to an auto-property - Updated failover logic to respect the new switch when determining actual failover partners
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 |
|---|---|
| src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/LocalAppContextSwitches.cs | Adds the new IgnoreServerProvidedFailoverPartner AppContext switch with property accessor and fixes a typo in existing documentation |
| src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs | Refactors failover partner storage, implements switch logic to conditionally use server-provided or connection-string failover partners |
| src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlCommand.cs | Updates property reference to use the new naming convention |
| src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs | Mirrors the netfx implementation for .NET Core, applying the same refactoring and switch logic |
| src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlCommand.cs | Updates property reference to use the new naming convention |
src/Microsoft.Data.SqlClient/netfx/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
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## release/6.0 #3703 +/- ##
===============================================
+ Coverage 75.51% 75.69% +0.17%
===============================================
Files 244 244
Lines 40212 40221 +9
===============================================
+ Hits 30368 30445 +77
+ Misses 9844 9776 -68
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:
|
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.
I don't really feel strongly enough about "" vs string.Empty to reject. But I'd happily re-approve if you did want to take that change.
Description
Backports #3625