Pavel Pereslegin created IGNITE-27188:
-----------------------------------------

             Summary: Java thin. Connection is not restored to restarted node
                 Key: IGNITE-27188
                 URL: https://issues.apache.org/jira/browse/IGNITE-27188
             Project: Ignite
          Issue Type: Bug
          Components: platforms ai3
            Reporter: Pavel Pereslegin


During integration testing of the {{backgroundReconnectInterval}} client 
property, it was discovered that the connection to a node that was restarted is 
not re-established because the node ID changes during the restart.

Reproducer
{code:java}
  @Test
  void testBackgroundReconnectInterval() {
      int nodesCount = 3;
      cluster.startAndInit(nodesCount, new int[]{2});

      String[] addresses = IntStream.range(0, nodesCount)
              .mapToObj(i -> "127.0.0.1:" + (10800 + i))
              .toArray(String[]::new);

      try (IgniteClient client = IgniteClient.builder()
              .backgroundReconnectInterval(100)
              .addresses(addresses).build()) {

          Awaitility.await().until(() -> client.connections().size(), 
CoreMatchers.is(nodesCount));

          cluster.stopNode(0);

          Awaitility.await().until(() -> client.connections().size(), 
CoreMatchers.is(nodesCount - 1));

          cluster.startNode(0);

          // Fails.
          Awaitility.await().until(() -> client.connections().size(), 
CoreMatchers.is(nodesCount ));
      }
  }
{code}

The test works fine if we comment the following lines in the 
ClientChannelHolder.getOrCreateChannelAsync:

{code:java}
  if (oldServerNode != null && !oldServerNode.id().equals(newNode.id())) {
      // New node on the old address.
      nodeChannelsByName.remove(oldServerNode.name(), this);
  }
{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to