You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ap...@apache.org on 2023/11/06 11:34:36 UTC

(ignite-3) branch main updated: IGNITE-20793 Fix flaky ItConnectionManagerTest#testShutdown (#2803)

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

apolovtsev pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git


The following commit(s) were added to refs/heads/main by this push:
     new 3125cb587f IGNITE-20793 Fix flaky ItConnectionManagerTest#testShutdown (#2803)
3125cb587f is described below

commit 3125cb587f0523666c6d7b94b4eede516d74ec39
Author: Alexander Polovtcev <al...@gmail.com>
AuthorDate: Mon Nov 6 13:34:29 2023 +0200

    IGNITE-20793 Fix flaky ItConnectionManagerTest#testShutdown (#2803)
---
 .../network/netty/ItConnectionManagerTest.java        | 19 ++++++++++++++++---
 .../recovery/RecoveryClientHandshakeManager.java      |  6 +++---
 2 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/modules/network/src/integrationTest/java/org/apache/ignite/internal/network/netty/ItConnectionManagerTest.java b/modules/network/src/integrationTest/java/org/apache/ignite/internal/network/netty/ItConnectionManagerTest.java
index dacb2fd547..9d48f98304 100644
--- a/modules/network/src/integrationTest/java/org/apache/ignite/internal/network/netty/ItConnectionManagerTest.java
+++ b/modules/network/src/integrationTest/java/org/apache/ignite/internal/network/netty/ItConnectionManagerTest.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.network.netty;
 
+import static org.apache.ignite.internal.testframework.IgniteTestUtils.testNodeName;
 import static org.apache.ignite.internal.testframework.IgniteTestUtils.waitForCondition;
 import static org.apache.ignite.internal.testframework.matchers.CompletableFutureCompletedMatcher.completedFuture;
 import static org.apache.ignite.utils.ClusterServiceTestUtils.defaultSerializationRegistry;
@@ -65,8 +66,10 @@ import org.apache.ignite.network.NetworkMessage;
 import org.apache.ignite.network.OutNetworkObject;
 import org.apache.ignite.network.serialization.MessageSerializationRegistry;
 import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.RepeatedTest;
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
 import org.junit.jupiter.api.extension.ExtendWith;
 
 /**
@@ -84,6 +87,13 @@ public class ItConnectionManagerTest extends BaseIgniteAbstractTest {
     @InjectConfiguration
     private NetworkConfiguration networkConfiguration;
 
+    private TestInfo testInfo;
+
+    @BeforeEach
+    void setTestInfo(TestInfo testInfo) {
+        this.testInfo = testInfo;
+    }
+
     /**
      * After each.
      */
@@ -104,7 +114,6 @@ public class ItConnectionManagerTest extends BaseIgniteAbstractTest {
         int port1 = 4000;
         int port2 = 4001;
 
-
         try (ConnectionManagerWrapper manager1 = startManager(port1);
                 ConnectionManagerWrapper manager2 = startManager(port2)) {
             var fut = new CompletableFuture<NetworkMessage>();
@@ -187,6 +196,10 @@ public class ItConnectionManagerTest extends BaseIgniteAbstractTest {
         ConnectionManagerWrapper manager2 = startManager(port2);
 
         NettySender sender1 = manager1.openChannelTo(manager2).get(3, TimeUnit.SECONDS);
+
+        // Wait for the channel to appear on the recipient side.
+        waitForCondition(() -> !manager2.channels().isEmpty(), 10_000);
+
         NettySender sender2 = manager2.openChannelTo(manager1).get(3, TimeUnit.SECONDS);
 
         assertNotNull(sender1);
@@ -428,7 +441,7 @@ public class ItConnectionManagerTest extends BaseIgniteAbstractTest {
      */
     private ConnectionManagerWrapper startManager(int port, MessageSerializationRegistry registry) throws Exception {
         UUID launchId = UUID.randomUUID();
-        String consistentId = UUID.randomUUID().toString();
+        String consistentId = testNodeName(testInfo, port);
 
         networkConfiguration.port().update(port).join();
 
@@ -485,7 +498,7 @@ public class ItConnectionManagerTest extends BaseIgniteAbstractTest {
             );
         }
 
-        public Map<ConnectorKey<String>, NettySender> channels() {
+        Map<ConnectorKey<String>, NettySender> channels() {
             return connectionManager.channels();
         }
     }
diff --git a/modules/network/src/main/java/org/apache/ignite/internal/network/recovery/RecoveryClientHandshakeManager.java b/modules/network/src/main/java/org/apache/ignite/internal/network/recovery/RecoveryClientHandshakeManager.java
index f157b5b07e..67f03822d8 100644
--- a/modules/network/src/main/java/org/apache/ignite/internal/network/recovery/RecoveryClientHandshakeManager.java
+++ b/modules/network/src/main/java/org/apache/ignite/internal/network/recovery/RecoveryClientHandshakeManager.java
@@ -247,9 +247,9 @@ public class RecoveryClientHandshakeManager implements HandshakeManager {
 
                 holderChannel.close().awaitUninterruptibly();
             } else {
-                String err = "Failed to acquire recovery descriptor during handshake, it is held by: " + descriptor.holderDescription();
-
-                LOG.info(err);
+                if (LOG.isInfoEnabled()) {
+                    LOG.info("Failed to acquire recovery descriptor during handshake, it is held by: {}", descriptor.holderDescription());
+                }
 
                 handshakeCompleteFuture.completeExceptionally(new ChannelAlreadyExistsException(remoteConsistentId));