Honor MWR config in client#40999
Merged
tvaron3 merged 2 commits intoAzure:mainfrom May 9, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR ensures that the Cosmos client now honors the multiple_write_locations configuration during request retries.
- Test cases have been updated to pass multiple_write_locations=True.
- The global endpoint manager’s API has been adjusted by removing get_use_multiple_write_locations and using a new method to check the MWR setting.
- The service request retry policy now relies on the new can_use_multiple_write_locations_for_request API.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/cosmos/azure-cosmos/tests/test_fault_injection_transport_async.py | Updated test to include multiple_write_locations flag |
| sdk/cosmos/azure-cosmos/tests/test_fault_injection_transport.py | Updated test to include multiple_write_locations flag |
| sdk/cosmos/azure-cosmos/azure/cosmos/aio/_global_endpoint_manager_async.py | Removed unused get_use_multiple_write_locations method |
| sdk/cosmos/azure-cosmos/azure/cosmos/_service_request_retry_policy.py | Updated API call to use can_use_multiple_write_locations_for_request |
| sdk/cosmos/azure-cosmos/azure/cosmos/_global_endpoint_manager.py | Removed unused get_use_multiple_write_locations method |
Comments suppressed due to low confidence (5)
sdk/cosmos/azure-cosmos/tests/test_fault_injection_transport_async.py:333
- [nitpick] Consider adding additional test cases where multiple_write_locations is set to false to verify that the client behaves correctly in that configuration.
preferred_locations=["First Region", "Second Region"],
sdk/cosmos/azure-cosmos/tests/test_fault_injection_transport.py:300
- [nitpick] Consider adding tests for scenarios with multiple_write_locations disabled to ensure that the client’s behavior remains as expected when this flag is not active.
preferred_locations=["First Region", "Second Region"],
sdk/cosmos/azure-cosmos/azure/cosmos/_service_request_retry_policy.py:60
- Verify that can_use_multiple_write_locations_for_request correctly replicates and possibly extends the previous functionality of get_use_multiple_write_locations to handle all relevant request scenarios.
or self.global_endpoint_manager.can_use_multiple_write_locations_for_request(self.request):
sdk/cosmos/azure-cosmos/azure/cosmos/aio/_global_endpoint_manager_async.py:62
- Confirm that the removal of get_use_multiple_write_locations does not leave any lingering dependencies and that all necessary checks now correctly use the new API.
def get_use_multiple_write_locations(self):
sdk/cosmos/azure-cosmos/azure/cosmos/_global_endpoint_manager.py:58
- Ensure that the removal of get_use_multiple_write_locations in the synchronous global endpoint manager is fully accounted for in all associated modules.
def get_use_multiple_write_locations(self):
Collaborator
|
API change check API changes are not detected in this pull request. |
simorenoh
approved these changes
May 9, 2025
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
The multiple_write_locations option on the cosmos client was not being honored when a request is retrying due to a service request error.