Skip to content

Change URL Getters to String in Storage#5648

Merged
samvaity merged 3 commits intoAzure:masterfrom
samvaity:update-url-return
Oct 2, 2019
Merged

Change URL Getters to String in Storage#5648
samvaity merged 3 commits intoAzure:masterfrom
samvaity:update-url-return

Conversation

@samvaity
Copy link
Copy Markdown
Member

@samvaity samvaity commented Oct 2, 2019

Closes #5602

@samvaity samvaity merged commit e300dd8 into Azure:master Oct 2, 2019
@samvaity samvaity deleted the update-url-return branch October 10, 2019 21:18
jeet1995 added a commit to jeet1995/azure-sdk-for-java that referenced this pull request Apr 12, 2026
Port hub region caching from .NET SDK (PR Azure#5648) to Java SDK.

Feature summary:
- After 2 consecutive 404/1002 (ReadSessionNotAvailable) on single-master
  accounts, SDK sets x-ms-cosmos-hub-region-processing-only header
- Non-hub regions return 403/3 (WriteForbidden); SDK retries to next region
- Hub region responds with 200 OK; SDK caches hub URI for that partition
- Future requests route directly to cached hub (warm path)
- Works for both PPAF and non-PPAF accounts

Implementation details:
- Feature flag: COSMOS.HUB_REGION_PROCESSING_ENABLED (default: false)
- New class: GlobalPartitionEndpointManagerForHubRegionRouting
  - Per-partition ConcurrentHashMap cache for hub region URIs
  - Warm/cold path routing, cache invalidation, thread-safe
- ClientRetryPolicy: 403/3 handling on read path for hub discovery
- ClientRetryPolicy: Hub header gated behind feature flag
- ClientRetryPolicy.onBeforeSendRequest: Warm path cache check
- RxDocumentClientImpl: Cache hub on successful response
- 13 unit tests covering all cache operations and eligibility

Files changed:
- Configs.java: Add feature flag constants and getter
- ClientRetryPolicy.java: Hub header gating, 403/3 read path, warm path
- RetryPolicy.java: Wire hub region manager
- RxDocumentClientImpl.java: Instantiate manager, cache on success
- GlobalPartitionEndpointManagerForHubRegionRouting.java (new)
- 5 test files updated for new constructor parameter

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

Change getLeaseUrl to getResourceUrl

4 participants