Consistently retrying 449 client-side across Gateway modes#49332
Merged
FabianMeiswinkel merged 35 commits intoJun 3, 2026
Conversation
…202605 Update JarStorageAccountName from oltpsparkcijarstore0326 to oltpsparkcijarstore0529 to point to the new storage account provisioned in the current ephemeral tenant rotation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…bianMeiswinkel/azure-sdk-for-java into users/fabianm/ReadManyByPKFix
…to users/fabianm/449Retry
Member
Author
|
/azp run java - cosmos - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Cosmos Gateway request path to handle HTTP 449 (RetryWith) consistently via client-side retry, and adds a gateway header to disable the legacy Gateway V1 server-side 449 retry loop where applicable.
Changes:
- Add a reusable
RetryWithRetryPolicyand a newGatewayRetryWithRetryPolicythat combines 449 RetryWith retry + existing gateway metadata/network retry behavior. - Ensure gateway requests send
x-ms-noretry-449: trueso 449 is retried client-side instead of via Gateway V1 server-side looping (with a ThinClient override). - Update/add unit and fault-injection tests to validate 449 retry behavior and diagnostics.
Show a summary per file
| File | Description |
|---|---|
| sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/ThinClientStoreModel.java | Overrides gateway 449 header behavior for ThinClient mode. |
| sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RxGatewayStoreModel.java | Adds x-ms-noretry-449 header and switches gateway invoke path to new composite retry policy w/ timeout propagation. |
| sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RetryWithRetryPolicy.java | New standalone retry policy implementing backoff + timeout budgeting for 449. |
| sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/HttpConstants.java | Introduces NO_RETRY_449 header constant. |
| sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/GatewayRetryWithRetryPolicy.java | New composite retry policy for gateway (449 RetryWith + existing metadata/network retries). |
| sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/Exceptions.java | Treats 449 as “commonly expected” to reduce noisy logs. |
| sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/directconnectivity/GoneAndRetryWithRetryPolicy.java | Refactors to use the new shared RetryWithRetryPolicy implementation. |
| sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/RxGatewayStoreModelTest.java | Adds unit tests asserting x-ms-noretry-449 header behavior. |
| sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/GatewayRetryWithRetryPolicyTest.java | New unit tests for the composite gateway retry policy. |
| sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/directconnectivity/GoneAndRetryWithRetryPolicyTest.java | Adjusts RetryWith test setup to match refactor. |
| sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/faultinjection/FaultInjectionServerErrorRuleOnGatewayV2Tests.java | Updates expectation: 449 is retried; validates retry diagnostics. |
| sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/faultinjection/FaultInjectionServerErrorRuleOnGatewayTests.java | Updates expectation: 449 is retried; validates retry diagnostics. |
Copilot's findings
- Files reviewed: 13/13 changed files
- Comments generated: 2
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Member
Author
|
/azp run java - cosmos - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Member
Author
|
/azp run java - cosmos - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
jeet1995
approved these changes
Jun 1, 2026
|
Azure Pipelines successfully started running 1 pipeline(s). |
Member
Author
|
/azp run java - cosmos - tests |
Member
Author
|
/azp run java - cosmos - spark |
|
Azure Pipelines successfully started running 1 pipeline(s). |
1 similar comment
|
Azure Pipelines successfully started running 1 pipeline(s). |
Member
Author
|
/azp run java - cosmos - kafka |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Member
Author
|
/azp run java - cosmos - kafka |
Member
Author
|
/azp run java - cosmos - spark |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Member
Author
|
/azp run java - cosmos - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
1 similar comment
|
Azure Pipelines successfully started running 1 pipeline(s). |
jeet1995
approved these changes
Jun 2, 2026
kushagraThapar
approved these changes
Jun 2, 2026
Member
Author
|
/azp run java - cosmos - kafka |
Member
Author
|
/azp run java - cosmos - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Member
Author
|
/azp run java - cosmos - spark |
|
Azure Pipelines successfully started running 1 pipeline(s). |
1 similar comment
|
Azure Pipelines successfully started running 1 pipeline(s). |
jeet1995
approved these changes
Jun 2, 2026
saragluna
approved these changes
Jun 3, 2026
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.
Description
Summary
Unifies 449 (
Retry With) handling across Gateway V1 and Gateway V2/Thin Client so retries are orchestrated client-side.RetryWithRetryPolicyfor 449 retry behavior.GatewayRetryWithRetryPolicyto combine gateway metadata retry handling with client-side 449 retries.x-ms-noretry-449for Gateway V1 requests so the service does not drive the retry loop.GoneAndRetryWithRetryPolicy.Testing
x-ms-noretry-449.RetryWithException.All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines