Skip to content

[Cosmos] Add Region Routing and Cross-Region Retry design doc#48714

Draft
jeet1995 wants to merge 1 commit intoAzure:mainfrom
jeet1995:abhmohanty/region-routing-design-doc
Draft

[Cosmos] Add Region Routing and Cross-Region Retry design doc#48714
jeet1995 wants to merge 1 commit intoAzure:mainfrom
jeet1995:abhmohanty/region-routing-design-doc

Conversation

@jeet1995
Copy link
Copy Markdown
Member

@jeet1995 jeet1995 commented Apr 7, 2026

Description

Adds a design document (sdk/cosmos/azure-cosmos/docs/RegionRouting.md) that describes how the Java SDK routes requests to specific regions, how preferredRegions and excludedRegions affect routing, and under what conditions ClientRetryPolicy retries cross-region - potentially bypassing configured region preferences.

Motivation

Created during a CFP region routing investigation. The investigation uncovered nuanced behavior in LocationCache and ClientRetryPolicy that was not documented anywhere.

Contents

  • LocationCache.resolveServiceEndpoint() - region resolution logic
  • getPreferredAvailableRoutingContexts() - endpoint list construction, regional endpoint fallback
  • Regional endpoint behavior - single-write vs multi-write divergence
  • ClientRetryPolicy exhaustive trace - all 8 usePreferredLocations call sites
  • ChangeFeedProcessor routing - metadata requests honor preferred regions
  • Cross-SDK comparison with Python SDK

Validated against

  • SDK versions: 4.40.0, 4.65.0, 4.75.0-alpha.20251008.4, 4.79.1
  • Account types: single-write and multi-write (3-region)
  • Kusto telemetry: ComputeRequest5M, Request5M, MgmtGlobalDatabaseAccountTrace

Documents how the Java SDK routes requests to specific regions via
LocationCache, how preferredRegions and excludedRegions affect routing,
and under what conditions ClientRetryPolicy retries cross-region —
potentially bypassing configured region preferences.

Covers:
- LocationCache.resolveServiceEndpoint() region resolution logic
- getPreferredAvailableRoutingContexts() endpoint list construction
- Regional endpoint fallback behavior (single-write vs multi-write)
- Exhaustive usePreferredLocations trace in ClientRetryPolicy
- ChangeFeedProcessor region routing
- Cross-SDK comparison with Python SDK

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions bot added the Cosmos label Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant