Skip to content

[Internal]Nregion: Adds support for including nregioncommit synchronous for less than Strong Consistency#5401

Merged
microsoft-github-policy-service[bot] merged 4 commits intomasterfrom
ananth/nregion-v3
Sep 30, 2025
Merged

[Internal]Nregion: Adds support for including nregioncommit synchronous for less than Strong Consistency#5401
microsoft-github-policy-service[bot] merged 4 commits intomasterfrom
ananth/nregion-v3

Conversation

@ananth7592
Copy link
Copy Markdown
Member

@ananth7592 ananth7592 commented Sep 12, 2025

Description

Feature: N-region synchronous commit support for < Strong consistency in SDK)

This PR brings in N region syncrhonous commit for accounts that have this feature enabled. The feature primarly brings in Barrier requests for Writes for less than Strong consistencies

The change contains two parts (one part is in this PR and other is done in Msdata/released as Direct package version 3.41.0 which is consumed in this PR)

Part 2 THIS PR : V3 Repo changes which include changes in AccountProperties to read the support for Nregion Commit .

-Adds support for including nregioncommit account feature while creating StoreClient within DocumentClient

Part 1 CHanges to ConsistencyWriter for adding Barrier requests and StoreResult to support the new NRegionCommittedGLSN which is critical to performing the barriers.

This is done in the Msdata ShareFiles and a new Direct package version 3.41.0 is released with this change

  • Refactors ConsistencyWriter to support synchronous barrier commits in NRegion accounts (< Strong) when EnableNRegionSynchronousCommit is enabled.

  • Ensures response is only returned once GlobalNRegionCommittedGLSN has caught up with the write LSN, preserving linearizability

Change PR in msdata: https://msdata.visualstudio.com/CosmosDB/_git/CosmosDB/pullrequest/1800184

Direct package changes

Direct version upgrade to 3.41.0 brings in the following changes

  • Part 1 from above: Adds write barrier logic to ConsistencyWriter using StoreResult's N-region committed LSN to enforce N region synchronous commit semantics for less-than-strong consistency writes.
  • Introduced SDK support for new regions of SingaporeCentral and SingaporeNorth
  • Resolves failover handling in strong consistency writes by ensuring stale barrier context is cleared when retrying across regions.
  • Introduced new Length Aware Range Comparators in EPK Range class.

Testing

Emulator test for NregionCommit Write Barrier

Used Http interceptor to "mock" nregioncommit feature enabled in AccountProperties.
Used Transport interceptor to mock GLobalNRegionCommitLSN for testing scenario.

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

@ananth7592 ananth7592 force-pushed the ananth/nregion-v3 branch 2 times, most recently from f3a0659 to 76efe81 Compare September 25, 2025 23:38
@ananth7592 ananth7592 changed the title [Internal]Nregion: Adds support for including nregioncommit account feature while creati… [Internal]Nregion: Adds support for including nregioncommit synchronous for less than Strong Consistency Sep 26, 2025
Comment thread Microsoft.Azure.Cosmos/src/ThinClientTransportSerializer.cs
Comment thread Microsoft.Azure.Cosmos/src/Tracing/TraceWriter.TraceJsonWriter.cs Outdated
Comment thread Microsoft.Azure.Cosmos/src/DocumentClient.cs Outdated
@kundadebdatta
Copy link
Copy Markdown
Member

Since we are bumping up the Direct version, it would be good to highlight the list of features (basically introduced through the cherry-picked commits) brought in through that direct release.

Copy link
Copy Markdown
Contributor

Copilot AI left a 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 adds support for N-region synchronous commit functionality for accounts with consistency levels less than Strong. The feature enables barrier requests for writes to ensure linearizability guarantees are maintained when GlobalNRegionCommittedGLSN hasn't caught up with the write LSN.

Key changes:

  • Adds EnableNRegionSynchronousCommit property to AccountProperties and AccountConfigurationProperties
  • Updates DocumentClient to pass N-region commit configuration to StoreClient during initialization
  • Upgrades Direct package version from 3.40.3 to 3.41.0 to support new backend functionality

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
AccountProperties.cs Adds EnableNRegionSynchronousCommit property for account-level feature configuration
DocumentClient.cs Updates CreateStoreModel to extract and pass N-region commit settings to StoreClient
Directory.Build.props Upgrades DirectVersion to 3.41.0 for backend N-region commit support
StoreReaderTest.cs Adds comprehensive test for N-region synchronous commit barrier functionality
DocumentClientUnitTests.cs Adds unit test to verify N-region commit configuration is passed to StoreClient
CosmosJsonSerializerUnitTests.cs Updates serialization test to include new EnableNRegionSynchronousCommit property
TraceWriter.TraceJsonWriter.cs Adds GlobalNRegionCommittedGLSN to trace output for debugging
ThinClientTransportSerializer.cs Duplicates accountName parameter in SerializeProxyRequestAsync call

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread Microsoft.Azure.Cosmos/src/ThinClientTransportSerializer.cs
Comment thread Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/StoreReaderTest.cs Outdated
@ananth7592 ananth7592 force-pushed the ananth/nregion-v3 branch 4 times, most recently from 21f26f4 to 4109785 Compare September 29, 2025 22:21
Updated ThinClientTransportSerializer to use regionalAccountName same as GlobalACcountName
Updated the TracingWriter to serialize GlobalNRegionCommittedGLSN
Copy link
Copy Markdown
Member

@kundadebdatta kundadebdatta left a comment

Choose a reason for hiding this comment

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

LGTM

@ananth7592
Copy link
Copy Markdown
Member Author

ananth7592 commented Sep 30, 2025 via email

Copy link
Copy Markdown
Member

@FabianMeiswinkel FabianMeiswinkel left a comment

Choose a reason for hiding this comment

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

LGTM - Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants