Skip to content

[Internal] DTS: Adds logic to build request and parse response#5576

Merged
kirankumarkolli merged 14 commits intomasterfrom
users/Meghana-Palaparthi/DTS_Committer
Feb 6, 2026
Merged

[Internal] DTS: Adds logic to build request and parse response#5576
kirankumarkolli merged 14 commits intomasterfrom
users/Meghana-Palaparthi/DTS_Committer

Conversation

@Meghana-Palaparthi
Copy link
Copy Markdown
Contributor

@Meghana-Palaparthi Meghana-Palaparthi commented Jan 27, 2026

Description

The main changes in this PR include -

  • Added a new DistributedTransactionCommitter class that manages the commit process for distributed transactions, including request enrichment, error handling, and a placeholder for abort logic.
  • Introduced DistributedTransactionCommitterUtils with a method to resolve collection resource IDs (RIDs) for all operations in a transaction, ensuring correct routing and execution.
  • Added a DistributedTransactionRequest class to encapsulate transaction operations and associated metadata, such as idempotency tokens and operation types.
  • Updated CosmosClient to pass the ClientContext when creating a DistributedWriteTransactionCore, enabling downstream components to access necessary context for transaction execution.# Pull Request Template

These updates lay the groundwork for executing distributed transactions with better serialization, error handling, and request management.

TODO: Add comprehensive tests to test the end-to-end flow of DTS in SDK

Type of change

Please delete options that are not relevant.

  • [] Bug fix (non-breaking change which fixes an issue)
  • [✓] New feature (non-breaking change which adds functionality)
  • [] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [] This change requires a documentation update

Closing issues

To automatically close an issue: closes #IssueNumber

@Meghana-Palaparthi Meghana-Palaparthi changed the base branch from users/Meghana-Palaparthi/DistributedTransactionSupport to master January 27, 2026 16:24
private void EnrichRequestMessage(RequestMessage requestMessage, DistributedTransactionRequest transactionRequest)
{
// Set DTC-specific headers
requestMessage.Headers.Add("x-ms-dtc-version", "0.0");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I believe we have httpconstants.cs, moving these headers to central location will be better

this.operationResizableWriteBuffer = new MemorySpanResizer<byte>(estimatedMaxOperationLength + operationSerializationOverheadOverEstimateInBytes);

Result r = await this.bodyStream.WriteRecordIOAsync(default, this.WriteOperation);
Debug.Assert(r == Result.Success, "Failed to serialize distributed transaction request");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@Meghana-Palaparthi Meghana-Palaparthi enabled auto-merge (squash) February 6, 2026 19:34
@kirankumarkolli kirankumarkolli merged commit 155430b into master Feb 6, 2026
32 checks passed
@kirankumarkolli kirankumarkolli deleted the users/Meghana-Palaparthi/DTS_Committer branch February 6, 2026 20:12
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.

3 participants