Fix thin-client routing fallback endpoint#49660
Open
arnabnandy7 wants to merge 5 commits into
Open
Conversation
Contributor
|
Thank you for your contribution @arnabnandy7! We will review the pull request and get back to you soon. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses a Cosmos thin-client routing fallback bug where ThinClientStoreModel could end up with a RegionalRoutingContext that has a gateway endpoint but no thin-client endpoint, leading to rootUri being null (reported in #49299). The changes focus on ensuring thin-client routing contexts are properly populated/remapped during endpoint resolution and adding regression coverage.
Changes:
- Add a defensive failure in
ThinClientStoreModel.getRootUriwhen the resolved routing context has no thin-client endpoint. - Enhance
LocationCache.resolveServiceEndpointto remap gateway-only routing contexts to thin-client-capable equivalents when thin-client mode is enabled, and attempt to populate the default routing context’s thin-client endpoint during account location processing. - Add unit tests covering default routing context thin-client endpoint population and explicit gateway-only routing context remapping.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/ThinClientStoreModel.java | Adds a defensive error when a thin-client endpoint is unexpectedly missing during thin-client request routing. |
| sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/routing/LocationCache.java | Adds thin-client-aware routing context resolution/remapping and attempts to populate thin-client endpoints on the default routing context. |
| sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/routing/LocationCacheTest.java | Adds unit tests intended to prevent regressions in thin-client endpoint fallback/remapping behavior. |
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
Fixes #49299.
This PR fixes a Cosmos thin-client routing fallback issue where
ThinClientStoreModelcould resolve to aRegionalRoutingContextwith a gateway endpoint but no thin-client endpoint, causingrootUrito be null.Changes include:
ThinClientStoreModelwhen a thin-client endpoint is unexpectedly unavailable.All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines