Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sdk/cosmos/azure-cosmos/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#### Breaking Changes

#### Bugs Fixed
* Fixed bug where `multiple_write_locations` option in client was not being honored. See [PR 40999](https://github.com/Azure/azure-sdk-for-python/pull/40999).

#### Other Changes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ def __init__(self, client):
self.last_refresh_time = 0
self._database_account_cache = None

def get_use_multiple_write_locations(self):
return self.location_cache.can_use_multiple_write_locations()

def get_refresh_time_interval_in_ms_stub(self):
return constants._Constants.DefaultEndpointsRefreshTime

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def ShouldRetry(self):

self.request.last_routed_location_endpoint_within_region = self.request.location_endpoint_to_route
if (_OperationType.IsReadOnlyOperation(self.request.operation_type)
or self.global_endpoint_manager.get_use_multiple_write_locations()):
or self.global_endpoint_manager.can_use_multiple_write_locations(self.request)):
self.update_location_cache()
# We just directly got to the next location in case of read requests
# We don't retry again on the same region for regional endpoint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,6 @@ def __init__(self, client):
self.last_refresh_time = 0
self._database_account_cache = None

def get_use_multiple_write_locations(self):
return self.location_cache.can_use_multiple_write_locations()

def get_refresh_time_interval_in_ms_stub(self):
return constants._Constants.DefaultEndpointsRefreshTime

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,9 @@ def test_mwr_succeeds(self: "TestFaultInjectionTransport"):

initialized_objects = self.setup_method_with_custom_transport(
custom_transport,
preferred_locations=["First Region", "Second Region"])
preferred_locations=["First Region", "Second Region"],
multiple_write_locations=True
)
container: ContainerProxy = initialized_objects["col"]

created_document = container.create_item(body=document_definition)
Expand Down Expand Up @@ -347,7 +349,9 @@ def test_mwr_region_down_succeeds(self: "TestFaultInjectionTransport"):

initialized_objects = self.setup_method_with_custom_transport(
custom_transport,
preferred_locations=["First Region", "Second Region"])
preferred_locations=["First Region", "Second Region"],
multiple_write_locations=True
)
container: ContainerProxy = initialized_objects["col"]

start:float = time.perf_counter()
Expand Down Expand Up @@ -466,7 +470,9 @@ def test_mwr_all_regions_down(self: "TestFaultInjectionTransport"):

initialized_objects = self.setup_method_with_custom_transport(
custom_transport,
preferred_locations=["First Region", "Second Region"])
preferred_locations=["First Region", "Second Region"],
multiple_write_locations=True
)
container: ContainerProxy = initialized_objects["col"]
with pytest.raises(ServiceRequestError):
container.upsert_item(body=document_definition)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,9 @@ async def test_mwr_succeeds_async(self: "TestFaultInjectionTransportAsync"):

initialized_objects = await TestFaultInjectionTransportAsync.setup_method_with_custom_transport(
custom_transport,
preferred_locations=["First Region", "Second Region"])
preferred_locations=["First Region", "Second Region"],
multiple_write_locations=True
)
try:
container: ContainerProxy = initialized_objects["col"]

Expand Down Expand Up @@ -383,7 +385,9 @@ async def test_mwr_region_down_succeeds_async(self: "TestFaultInjectionTransport

initialized_objects = await TestFaultInjectionTransportAsync.setup_method_with_custom_transport(
custom_transport,
preferred_locations=["First Region", "Second Region"])
preferred_locations=["First Region", "Second Region"],
multiple_write_locations=True
)
try:
container: ContainerProxy = initialized_objects["col"]

Expand Down Expand Up @@ -508,7 +512,9 @@ async def test_mwr_all_regions_down_async(self: "TestFaultInjectionTransportAsyn

initialized_objects = await TestFaultInjectionTransportAsync.setup_method_with_custom_transport(
custom_transport,
preferred_locations=["First Region", "Second Region"])
preferred_locations=["First Region", "Second Region"],
multiple_write_locations=True
)
try:
container: ContainerProxy = initialized_objects["col"]
with pytest.raises(ServiceRequestError):
Expand Down