From 04f067dbb30b926197c040f95977d509288a6b92 Mon Sep 17 00:00:00 2001 From: kirankumarkolli Date: Wed, 3 Nov 2021 13:17:31 -0700 Subject: [PATCH] Moving to ValueFactory overloads of ConcurrentDictionary --- Microsoft.Azure.Cosmos/src/Routing/GatewayAddressCache.cs | 3 ++- .../src/Routing/GlobalPartitionEndpointManagerCore.cs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Microsoft.Azure.Cosmos/src/Routing/GatewayAddressCache.cs b/Microsoft.Azure.Cosmos/src/Routing/GatewayAddressCache.cs index f9f541b12b..721270bd41 100644 --- a/Microsoft.Azure.Cosmos/src/Routing/GatewayAddressCache.cs +++ b/Microsoft.Azure.Cosmos/src/Routing/GatewayAddressCache.cs @@ -571,7 +571,8 @@ internal Tuple ToPartiti addressInfo.PhysicalUri); HashSet pkRangeIdSet = this.serverPartitionAddressToPkRangeIdMap.GetOrAdd( - new ServerKey(new Uri(addressInfo.PhysicalUri)), new HashSet()); + new ServerKey(new Uri(addressInfo.PhysicalUri)), + (_) => new HashSet()); lock (pkRangeIdSet) { pkRangeIdSet.Add(partitionKeyRangeIdentity); diff --git a/Microsoft.Azure.Cosmos/src/Routing/GlobalPartitionEndpointManagerCore.cs b/Microsoft.Azure.Cosmos/src/Routing/GlobalPartitionEndpointManagerCore.cs index b82d3ece8e..a4ab1221e6 100644 --- a/Microsoft.Azure.Cosmos/src/Routing/GlobalPartitionEndpointManagerCore.cs +++ b/Microsoft.Azure.Cosmos/src/Routing/GlobalPartitionEndpointManagerCore.cs @@ -134,7 +134,7 @@ public override bool TryMarkEndpointUnavailableForPartitionKeyRange( PartitionKeyRangeFailoverInfo partionFailover = this.PartitionKeyRangeToLocation.Value.GetOrAdd( partitionKeyRange, - new PartitionKeyRangeFailoverInfo(failedLocation)); + (_) => new PartitionKeyRangeFailoverInfo(failedLocation)); // Will return true if it was able to update to a new region if (partionFailover.TryMoveNextLocation(