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

Preserve distributed transactions on pooled connection reset #3019

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

mdaigle
Copy link
Contributor

@mdaigle mdaigle commented Nov 18, 2024

The current behavior only preserves transaction state for the root transaction. Enlisted connections that are reset will be placed in the transacted connection pool, but in some situations, will no longer participate in the transaction. The next connection to request the connection will expect it to be participating in the transaction, but actions on the connection will auto-commit.

This changes the reset logic to preserve transaction state for enlisted connections (part of a distributed transaction, but not root).

@mdaigle
Copy link
Contributor Author

mdaigle commented Nov 18, 2024

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mdaigle mdaigle changed the title Preserve distributed transactions on connection reset Preserve distributed transactions on pooled connection reset Nov 18, 2024
Copy link

codecov bot commented Nov 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 72.70%. Comparing base (bb4c3b7) to head (8b5c409).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3019      +/-   ##
==========================================
+ Coverage   72.68%   72.70%   +0.01%     
==========================================
  Files         283      283              
  Lines       58975    58976       +1     
==========================================
+ Hits        42864    42876      +12     
+ Misses      16111    16100      -11     
Flag Coverage Δ
addons 92.58% <ø> (ø)
netcore 75.54% <100.00%> (+0.05%) ⬆️
netfx 71.16% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mdaigle mdaigle marked this pull request as ready for review November 20, 2024 17:17
@mdaigle mdaigle linked an issue Nov 20, 2024 that may be closed by this pull request
@mdaigle mdaigle added the 🐛 Bug! Issues that are bugs in the drivers we maintain. label Nov 25, 2024
@@ -1075,9 +1075,11 @@ private void ResetConnection()
// distributed transaction - otherwise don't reset!
if (Is2000)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving Is2000 logic in place for now until we remove support for it. The fix will not apply to versions before 2000.


[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), Timeout = 10000)]

public void Test_EnlistedTransactionPreservedWhilePooled()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified that these tests currently fail when run on main against an azure db.

@mdaigle mdaigle requested review from benrr101 and a team January 2, 2025 22:08
@mdaigle mdaigle added this to the 7.0-preview1 milestone Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug! Issues that are bugs in the drivers we maintain.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Azure SQL DTC bug
3 participants