-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Effective Preferred Locations #39714
base: main
Are you sure you want to change the base?
Conversation
API change check API changes are not detected in this pull request. |
/azp run python - cosmos - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
…into tvaron3/effectivePreferredRegions
/azp run python - cosmos - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
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.
love the way the test is made as well, thanks Tomas!
I think you need to disambiguate between how reads and writes behave. |
Another aspect is testing - it would be good to add coverage in our retry policy tests when the client isn't configured with preferred locations - 503, 408, 404:1002 - all have cross-region retry semantics. |
Background
Preferred locations is an option set on the cosmos client. It indicates to the SDK in what priority to route requests.
Example
Problem
Previously to this pr, if no preferred locations were passed into the cosmos client then the SDK would route requests only to the hub region for single write accounts. For multi-write accounts, the SDK would route requests only to the endpoint passed in through the client. This is undesirable because it would be opting out customers by default to an availability feature.
Solution
If no preferred locations and the global endpoint are passed into the cosmos client, then the SDK will populate it using the account regions. If a regional endpoint is passed in, the existing behavior will be kept.
Note: This is a breaking change for customers using bounded staleness consistency.
Relevant Issue