Conversation
ananth7592
reviewed
Oct 14, 2025
This was referenced Oct 15, 2025
xinlian12
reviewed
Oct 23, 2025
xinlian12
reviewed
Oct 23, 2025
This was referenced Apr 27, 2026
Open
Merged
This was referenced Apr 30, 2026
Bump Microsoft.Azure.Cosmos from 3.58.0 to 3.59.0
azureossd/general-database-connectivity-samples#40
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Template
Description
This change is limited to single master accounts. During partition-level failover and failback under session consistency, a timing gap can cause read requests to fail with 404/1002 errors. When a partition temporarily fails over to a secondary region and later begins failing back to the primary region, the SDK’s read circuit breaker (PPCB) may start routing reads back to the primary region before it has fully caught up with the writes from the failover region. As a result, reads using session tokens from the previous write region may fail because the primary region does not yet have the corresponding session state. Since the SDK currently does not perform cross-regional retries for 404/1002 responses, these reads continue to fail until the primary region is fully synchronized. The goal is to leverage the new backend header x-ms-cosmos-hub-region-processing-only to detect such conditions and route retry requests to the correct write (hub) region, ensuring successful session-consistent reads during the failback window.
As part of this change, the hub region header is added to the second retry request that failed with 404/1002 Read Session Not Available. In order to avoid running into a loop of retries to find the hub region, the first retry request for 404/1002 does not container header and retries on the available write region from location cache. If that request also fails with 404/1002 then subsequent retry requests all contain the header. If the request has the header and it does not hit the primary hub region then backend return 403/3. SDK will retry the subsequent 403/3 retry requests with the hub region header added.
Type of change
Please delete options that are not relevant.
Closing issues
To automatically close an issue: closes #5440