diff --git a/Microsoft.Azure.Cosmos/src/Routing/GatewayAddressCache.cs b/Microsoft.Azure.Cosmos/src/Routing/GatewayAddressCache.cs index fdb758e2ec..1df09fa6b5 100644 --- a/Microsoft.Azure.Cosmos/src/Routing/GatewayAddressCache.cs +++ b/Microsoft.Azure.Cosmos/src/Routing/GatewayAddressCache.cs @@ -479,6 +479,33 @@ private static void SetTransportAddressUrisToUnhealthy( } } } + // Overloaded method, the previous Lazy> will be removed in a future release + // Once this is merged to master, we will cherry-pick the v3 master commit to OSS and create a new OSS release to use the OSS commit in the msdata PR to unblock the build failures from OSS. + private static void SetTransportAddressUrisToUnhealthy( + PartitionAddressInformation stalePartitionAddressInformation, + Lazy> failedEndpoints) + { + if (stalePartitionAddressInformation == null || + failedEndpoints == null || + !failedEndpoints.IsValueCreated) + { + return; + } + + IReadOnlyList perProtocolPartitionAddressInformation = stalePartitionAddressInformation.Get(Protocol.Tcp)?.ReplicaTransportAddressUris; + if (perProtocolPartitionAddressInformation == null) + { + return; + } + + foreach (TransportAddressUri failed in perProtocolPartitionAddressInformation) + { + if (failedEndpoints.Value.ContainsKey(failed)) + { + failed.SetUnhealthy(); + } + } + } private static void LogPartitionCacheRefresh( IClientSideRequestStatistics clientSideRequestStatistics,