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

Send retained transaction descriptor in MARS TDS header for .NET Core and .NET 5+ #1624

Merged
merged 1 commit into from
May 27, 2022

Conversation

swh-cb
Copy link
Contributor

@swh-cb swh-cb commented May 24, 2022

The retained transaction descriptor (TdsParser._retainedTransactionId) is send in the MARS TDS header for .NET Core and .NET 5+ applications when a distributed MSDTC transaction is explicitly rolled back without defecting. The retained transaction descriptor must be sent to the server on subsequent executions even though the transaction is considered to be rolled back. The .NET Framework driver already sends the retained transaction descriptor in this case (see here).

Fixes #1623

@Wraith2
Copy link
Contributor

Wraith2 commented May 25, 2022

Looks like a straightforward fix and improvement. Have you checked to make sure that the _retainedTransactionId field is correctly zeroed when the transaction is finished with?

@swh-cb
Copy link
Contributor Author

swh-cb commented May 25, 2022

Yes, the _retainedTransactionId field is cleared (SqlInternalTransaction.NullTransactionId) in the following cases:

  • Connection is enlisted in null transaction or a new transaction (Begin or Propagate for TransactionManagerRequest request)
  • Notification from the server of a new transaction (ENV_BEGINTRAN or ENV_ENLISTDTC for ENVCHANGE notification)
  • Notification from the server that a server-side transaction ends by anything other than rollback (ENV_DEFECTDTC, ENV_TRANSACTIONENDED or ENV_COMMITTRAN for ENVCHANGE notification)

Copy link
Contributor

@David-Engel David-Engel left a comment

Choose a reason for hiding this comment

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

LGTM

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.

Send retained transaction descriptor in MARS TDS header for .NET Core and .NET 5+
5 participants