Skip to content

Honor MWR config in client#40999

Merged
tvaron3 merged 2 commits intoAzure:mainfrom
tvaron3:tvaron3/mwrBug
May 9, 2025
Merged

Honor MWR config in client#40999
tvaron3 merged 2 commits intoAzure:mainfrom
tvaron3:tvaron3/mwrBug

Conversation

@tvaron3
Copy link
Copy Markdown
Member

@tvaron3 tvaron3 commented May 9, 2025

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.

Copilot AI review requested due to automatic review settings May 9, 2025 15:24
@tvaron3 tvaron3 requested a review from a team as a code owner May 9, 2025 15:24
@github-actions github-actions Bot added the Cosmos label May 9, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a 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 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):

@azure-sdk
Copy link
Copy Markdown
Collaborator

API change check

API changes are not detected in this pull request.

Copy link
Copy Markdown
Member

@FabianMeiswinkel FabianMeiswinkel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tvaron3 tvaron3 merged commit 6364ba3 into Azure:main May 9, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants