[Internal] ThinProxy Integration: Adds New HttpTimeoutPolicy and Fix Cross Regional Retry Logic#5276
Merged
kirankumarkolli merged 9 commits intomasterfrom Jul 15, 2025
Conversation
HttpTimeoutPolicy and Fix Cross Regional Retry LogicHttpTimeoutPolicy and Fix Cross Regional Retry Logic
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces an aggressive HTTP timeout policy for thin clients and corrects cross-regional retry routing by resolving thin proxy endpoints.
- Adds
HttpTimeoutPolicyForThinClientand plugs it intoHttpTimeoutPolicy.GetTimeoutPolicy - Extends routing (
LocationCache,ClientRetryPolicy,IGlobalEndpointManager,GlobalEndpointManager) to use thin client endpoints - Adds a new integration test covering read-item retries across regions in thin client mode
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/.../RegionFailoverTests.cs | New test for read‐item retry logic under thin client mode |
| tests/.../MockSetupsHelper.cs | Extends account mock setup to include thin client locations |
| src/ThinClientStoreClient.cs | Enables thin‐client flag in HTTP invocations |
| src/Routing/LocationCache.cs | Adds thin‐client endpoint getters and static IsMetaData helper |
| src/Routing/IGlobalEndpointManager.cs | Exposes thin‐client endpoint collections on the interface |
| src/Routing/GlobalEndpointManager.cs | Implements thin‐client endpoint properties |
| src/HttpClient/HttpTimeoutPolicyForThinClient.cs | New timeout policy class for thin client |
| src/HttpClient/HttpTimeoutPolicy.cs | Updates policy selection logic for thin client |
| src/ClientRetryPolicy.cs | Routes requests to thin‐client endpoints when enabled |
Comments suppressed due to low confidence (3)
Microsoft.Azure.Cosmos/src/HttpClient/HttpTimeoutPolicyForThinClient.cs:42
- [nitpick] The comment seems contradictory: retrieving metadata is idempotent, so it should indicate 'is idempotent' rather than 'is not idempotent'. Consider correcting the comment to reflect the correct idempotency assumptions.
// The hot path should always be safe to retires since it should be retrieving meta data
Microsoft.Azure.Cosmos/src/HttpClient/HttpTimeoutPolicyForThinClient.cs:12
- [nitpick] Public field names should follow PascalCase naming conventions (e.g. 'ShouldRetry') or be made private with public properties to align with .NET naming guidelines.
public bool shouldRetry;
Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/PartitionKeyRangeFailoverTests/RegionFailoverTests.cs:214
- [nitpick] Consider adding a similar test for write scenarios to ensure the HttpTimeoutPolicyForThinClient write path behaves as expected (no retries and correct 503 behavior).
[TestMethod]
HttpTimeoutPolicy and Fix Cross Regional Retry LogicHttpTimeoutPolicy and Fix Cross Regional Retry Logic
kundadebdatta
commented
Jul 9, 2025
HttpTimeoutPolicy and Fix Cross Regional Retry LogicHttpTimeoutPolicy and Fix Cross Regional Retry Logic
jeet1995
previously approved these changes
Jul 11, 2025
kirankumarkolli
approved these changes
Jul 15, 2025
HttpTimeoutPolicy and Fix Cross Regional Retry Logic HttpTimeoutPolicy and Fix Cross Regional Retry Logic
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 PR adds the support for the below:
Adds new HttpTimeoutPolicy: Primarily create a new http timeout policy to retry the proxy requests faster than the regular Gateway requests. We need an aggressive timeout policy to meet the SLA bar.
Adds/ Fixes Cross Regional Retry Logic: Currently the cross regional retry logic for thin client has a gap and it does not resolve the thin proxy endpoints correctly. This PR is fixing that behavior.
Type of change
Please delete options that are not relevant.
Closing issues
To automatically close an issue: closes #5275