From d58c5c9f1b7830dd2cf74c94ddb65eb1f6969141 Mon Sep 17 00:00:00 2001 From: Jake Willey Date: Fri, 10 Sep 2021 10:15:10 -0700 Subject: [PATCH 1/3] Availability: Adds EnableTcpConnectionEndpointRediscovery to true by default --- Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs | 2 +- .../CosmosClientOptionsUnitTests.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs b/Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs index 49bb9cd2e6..6088630b77 100644 --- a/Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs +++ b/Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs @@ -485,7 +485,7 @@ public CosmosSerializer Serializer /// /// The default value is false /// - public bool EnableTcpConnectionEndpointRediscovery { get; set; } = false; + public bool EnableTcpConnectionEndpointRediscovery { get; set; } = true; /// /// Gets or sets a delegate to use to obtain an HttpClient instance to be used for HTTPS communication. diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosClientOptionsUnitTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosClientOptionsUnitTests.cs index 838a3beaa6..c2a7a8c606 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosClientOptionsUnitTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosClientOptionsUnitTests.cs @@ -77,7 +77,7 @@ public void VerifyCosmosConfigurationPropertiesGetUpdated() Assert.IsNotNull(clientOptions.Serializer); Assert.IsNull(clientOptions.WebProxy); Assert.IsFalse(clientOptions.LimitToEndpoint); - Assert.IsFalse(clientOptions.EnableTcpConnectionEndpointRediscovery); + Assert.IsTrue(clientOptions.EnableTcpConnectionEndpointRediscovery); Assert.IsNull(clientOptions.HttpClientFactory); Assert.AreNotEqual(consistencyLevel, clientOptions.ConsistencyLevel); Assert.IsFalse(clientOptions.EnablePartitionLevelFailover); @@ -93,7 +93,7 @@ public void VerifyCosmosConfigurationPropertiesGetUpdated() Assert.IsNull(policy.MaxRequestsPerTcpConnection); Assert.IsNull(policy.MaxTcpConnectionsPerEndpoint); Assert.IsTrue(policy.EnableEndpointDiscovery); - Assert.IsFalse(policy.EnableTcpConnectionEndpointRediscovery); + Assert.IsTrue(policy.EnableTcpConnectionEndpointRediscovery); Assert.IsNull(policy.HttpClientFactory); Assert.AreNotEqual(Cosmos.ConsistencyLevel.Session, clientOptions.ConsistencyLevel); Assert.IsFalse(policy.EnablePartitionLevelFailover); From fbe4d21b4d6c0b60f57d21dab04c9e012809384a Mon Sep 17 00:00:00 2001 From: Jake Willey Date: Fri, 10 Sep 2021 10:34:47 -0700 Subject: [PATCH 2/3] Update comment --- Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs b/Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs index 6088630b77..590b5fe401 100644 --- a/Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs +++ b/Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs @@ -483,7 +483,7 @@ public CosmosSerializer Serializer /// Does not apply if is used. /// /// - /// The default value is false + /// The default value is true /// public bool EnableTcpConnectionEndpointRediscovery { get; set; } = true; From ce3542657262d5a8d5bf2590476c95ba49bf1f47 Mon Sep 17 00:00:00 2001 From: Jake Willey Date: Fri, 10 Sep 2021 13:40:37 -0700 Subject: [PATCH 3/3] Fix test --- .../ClientConfigurationDiagnosticTest.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/ClientConfigurationDiagnosticTest.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/ClientConfigurationDiagnosticTest.cs index a4c686e315..5b687090fa 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/ClientConfigurationDiagnosticTest.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/ClientConfigurationDiagnosticTest.cs @@ -48,7 +48,7 @@ public async Task ClientConfigTest() } [TestMethod] - public void CleintConfigWithOptionsTest() + public void ClientConfigWithOptionsTest() { CosmosClientOptions options = new CosmosClientOptions { @@ -66,7 +66,7 @@ public void CleintConfigWithOptionsTest() Assert.AreEqual(tcpconfig.ConnectionTimeout, 30); Assert.AreEqual(tcpconfig.IdleConnectionTimeout, -1); Assert.AreEqual(tcpconfig.MaxRequestsPerChannel, 30); - Assert.AreEqual(tcpconfig.TcpEndpointRediscovery, false); + Assert.AreEqual(tcpconfig.TcpEndpointRediscovery, true); GatewayConnectionConfig gwConfig = cosmosClient.ClientConfigurationTraceDatum.GatewayConnectionConfig; Assert.AreEqual(gwConfig.UserRequestTimeout, 50);