You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by pt...@apache.org on 2021/02/15 11:58:13 UTC

[ignite] branch master updated: IGNITE-14173 .NET: Fix partition awareness auto-disable on old servers

This is an automated email from the ASF dual-hosted git repository.

ptupitsyn pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new 1fa1ee0  IGNITE-14173 .NET: Fix partition awareness auto-disable on old servers
1fa1ee0 is described below

commit 1fa1ee0dceff5b1c09c63e112a4e3414e4d3403e
Author: Pavel Tupitsyn <pt...@apache.org>
AuthorDate: Mon Feb 15 14:57:41 2021 +0300

    IGNITE-14173 .NET: Fix partition awareness auto-disable on old servers
    
    * Fix failing `TestReconnectToOldNodeDisablesPartitionAwareness`: when thin client reconnects to a new "default" node, and that node does not support partition awareness, the feature should be disabled automatically.
    * Enable the test on .NET Core
    * Fix compatibility test flakiness: add port range to `JavaServer.GetClientConfiguration`
---
 .../ClientReconnectCompatibilityTest.cs            |  2 --
 .../dotnet/Apache.Ignite.Core.Tests/JavaServer.cs  |  4 +++-
 .../Impl/Client/ClientFailoverSocket.cs            | 22 +++++++++++++++-------
 3 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/Compatibility/ClientReconnectCompatibilityTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/Compatibility/ClientReconnectCompatibilityTest.cs
index 635371a..67559ed 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/Compatibility/ClientReconnectCompatibilityTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/Compatibility/ClientReconnectCompatibilityTest.cs
@@ -15,7 +15,6 @@
  * limitations under the License.
  */
 
-#if !NETCOREAPP
 namespace Apache.Ignite.Core.Tests.Client.Compatibility
 {
     using System;
@@ -107,4 +106,3 @@ namespace Apache.Ignite.Core.Tests.Client.Compatibility
         }
     }
 }
-#endif
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/JavaServer.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/JavaServer.cs
index 1da2703..40a02c8 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/JavaServer.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/JavaServer.cs
@@ -134,7 +134,9 @@ namespace Apache.Ignite.Core.Tests
         /// </summary>
         public static IgniteClientConfiguration GetClientConfiguration()
         {
-            return new IgniteClientConfiguration("127.0.0.1:" + ClientPort);
+            var endpoint = string.Format("127.0.0.1:{0}..{1}", ClientPort, ClientPort + 5);
+
+            return new IgniteClientConfiguration(endpoint);
         }
 
         /// <summary>
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/ClientFailoverSocket.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/ClientFailoverSocket.cs
index 6bf0f2d..a7dfb9b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/ClientFailoverSocket.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/ClientFailoverSocket.cs
@@ -132,8 +132,8 @@ namespace Apache.Ignite.Core.Impl.Client
 
             _logger = (_config.Logger ?? NoopLogger.Instance).GetLogger(GetType());
 
-            Connect();
-            OnFirstConnect();
+            ConnectDefaultSocket();
+            OnFirstConnection();
         }
 
         /// <summary>
@@ -272,7 +272,7 @@ namespace Apache.Ignite.Core.Impl.Client
 
                 if (_socket == null || (_socket.IsDisposed && !_config.ReconnectDisabled))
                 {
-                    Connect();
+                    ConnectDefaultSocket();
                 }
 
                 return _socket;
@@ -419,17 +419,19 @@ namespace Apache.Ignite.Core.Impl.Client
         }
 
         /// <summary>
-        /// Connects the socket.
+        /// Connects the default socket.
         /// </summary>
-        private void Connect()
+        private void ConnectDefaultSocket()
         {
             _socket = GetNextSocket();
+
+            OnNewDefaultConnection();
         }
 
         /// <summary>
-        /// Performs initial checks when the first connection to the cluster has been established.
+        /// Performs feature checks when a new default connection is established.
         /// </summary>
-        private void OnFirstConnect()
+        private void OnNewDefaultConnection()
         {
             if (_config.EnablePartitionAwareness && !_socket.Features.HasOp(ClientOp.CachePartitions))
             {
@@ -448,7 +450,13 @@ namespace Apache.Ignite.Core.Impl.Client
 
                 _logger.Warn("Automatic server node discovery is not supported by the server");
             }
+        }
 
+        /// <summary>
+        /// Performs initial checks when the first connection to the cluster has been established.
+        /// </summary>
+        private void OnFirstConnection()
+        {
             if (_socket.Features.HasFeature(ClientBitmaskFeature.BinaryConfiguration))
             {
                 var serverBinaryCfg = _socket.DoOutInOp(