-
Notifications
You must be signed in to change notification settings - Fork 525
HttpTimeoutPolicy Improvements Phase 1: Fixes QueryPlan requests retry gaps #5476
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HttpTimeoutPolicy Improvements Phase 1: Fixes QueryPlan requests retry gaps #5476
Conversation
…ype and operation type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good!
DocumentServiceRequest Using Resource and Operation Type
There was a problem hiding this 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 refactors the retry safety determination logic from using HTTP method-based checks to using DocumentServiceRequest-based checks. The primary purpose is to consolidate retry logic by moving the IsSafeToRetry decision from individual timeout policy classes to a centralized implementation in CosmosHttpClientCore that considers the request's properties.
Key changes:
- Removed the abstract
IsSafeToRetry(HttpMethod)method fromHttpTimeoutPolicyand all its implementations - Added a new static
IsSafeToRetry(DocumentServiceRequest)method inCosmosHttpClientCorethat determines retry safety based on request properties - Updated test files to pass
documentServiceRequestparameter andOperationTypeto support the new retry logic
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| HttpTimeoutPolicy.cs | Removed abstract IsSafeToRetry(HttpMethod) method declaration |
| HttpTimeoutPolicyNoRetry.cs | Removed IsSafeToRetry implementation |
| HttpTimeoutPolicyForThinClient.cs | Removed IsSafeToRetry method and updated to use shouldRetry field directly |
| HttpTimeoutPolicyForPartitionFailover.cs | Removed IsSafeToRetry implementation |
| HttpTimeoutPolicyDefault.cs | Removed IsSafeToRetry implementation |
| HttpTimeoutPolicyControlPlaneRetriableHotPath.cs | Removed IsSafeToRetry implementation and related check |
| HttpTimeoutPolicyControlPlaneRead.cs | Removed IsSafeToRetry implementation |
| CosmosHttpClientCore.cs | Added new IsSafeToRetry(DocumentServiceRequest) method, updated retry logic to use it, simplified IsOutOfRetries signature |
| GatewayStoreModelTest.cs | Updated test to pass documentServiceRequest parameter |
| CosmosHttpClientCoreTests.cs | Added OperationType parameter to test scenarios and updated all test calls |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
@microsoft-github-policy-service agree company="Microsoft" |
kundadebdatta
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM Now.
DocumentServiceRequest Using Resource and Operation TypeDocumentServiceRequest Using Resource and Operation Type
DocumentServiceRequest Using Resource and Operation TypeIsSafeToRetry() Method Out of Individual Timeout Policies
FabianMeiswinkel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few NITs - otherwise LGTM now. Thanks!
|
Please enhance PR description
|
IsSafeToRetry() Method Out of Individual Timeout PoliciesIsSafeToRetry() Method behavior based on the OperationType and ResourceType
IsSafeToRetry() Method behavior based on the OperationType and ResourceTypeIsSafeToRetry() method behavior based on the OperationType and ResourceType
IsSafeToRetry() method behavior based on the OperationType and ResourceType
07178e2
FabianMeiswinkel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM now.
…y gaps (#5476) # Pull Request Template ## Description This PR fixes: 1. Allow QueryPlan requests to do local retries (within region), before doing cross regional retries. 2. Removing dependency on HttpMethod based retry, Enable all `GET` calls without `DocumentServiceRequest` to retry. 3. Enable caller (CosmosHttpClientCore) to determine when to retry safely. Additional details on the updates in this PR: Allow Retries in following cases: - When `DocumentServiceRequest` is null - If the DocumentServiceRequest's ResourceType is Address - If the DocumentServiceRequest is a ReadOnlyRequest (based on existing criteria). **Follow up**: Another PR will include enhancing/adjusting the defined timeouts on `HttpTimeoutPolicyForPartitionFailover` and potentially `HttpTimeoutPolicyForThinClient` ## Type of change Please delete options that are not relevant. - [x] Bug fix (non-breaking change which fixes an issue) ## Closing issues To automatically close an issue: closes #5481 --------- Co-authored-by: Debdatta Kunda <[email protected]>
Pull Request Template
Description
This PR fixes:
GETcalls withoutDocumentServiceRequestto retry.Additional details on the updates in this PR:
Allow Retries in following cases:
DocumentServiceRequestis nullFollow up:
Another PR will include enhancing/adjusting the defined timeouts on
HttpTimeoutPolicyForPartitionFailoverand potentiallyHttpTimeoutPolicyForThinClientType of change
Please delete options that are not relevant.
Closing issues
To automatically close an issue: closes #5481