You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2022/06/28 03:08:47 UTC

[GitHub] [ignite] wkhappy1 commented on a diff in pull request #10110: IGNITE-17217 Java thin: reload addresses from ClientAddressFinder on connection loss

wkhappy1 commented on code in PR #10110:
URL: https://github.com/apache/ignite/pull/10110#discussion_r907987050


##########
modules/kubernetes/src/test/java/org/apache/ignite/kubernetes/discovery/TestClusterClientConnection.java:
##########
@@ -49,4 +49,44 @@ public void testClientConnectsToCluster() throws Exception {
         cache.put(1, 2);
         assertEquals(2, cache.get(1));
     }
+
+    @Test
+    public void testClientReConnectsToClusterAfterPodIpChange() throws Exception {
+        mockServerResponse();
+
+        IgniteConfiguration cfg = getConfiguration(getTestIgniteInstanceName(), false);
+
+        IgniteEx crd = startGrid(cfg);
+        String crdAddr = crd.localNode().addresses().iterator().next();
+
+        mockServerResponse(crdAddr);
+
+        ClientConfiguration ccfg = new ClientConfiguration();
+        ccfg.setAddressesFinder(new ThinClientKubernetesAddressFinder(prepareConfiguration()));
+        IgniteClient client = Ignition.startClient(ccfg);
+
+        ClientCache cache = client.createCache("cache");
+        cache.put(1, 2);
+        assertEquals(2, cache.get(1));
+
+        //stop node and change port still can connect
+        Ignition.stop(crd.name(), true);
+        int newPort = 10801;
+        ccfg.setAddressesFinder(new ThinClientKubernetesAddressFinder(prepareConfiguration(),newPort));
+        mockServerResponse(5,crdAddr);
+
+        cfg = getConfiguration(getTestIgniteInstanceName(), false);
+        cfg.setSqlConnectorConfiguration(new SqlConnectorConfiguration().setPort(newPort));

Review Comment:
   > `setSqlConnectorConfiguration` is deprecated, please use `setClientConnectorConfiguration` instead.
   
   i found ClientListenerProcessor method isNotDefault(cliConnCfg)  will check ClientConnectorConfiguration isDefault then it will return falseļ¼Œthen   cliConnCfg = new ClientConnectorConfiguration();
   so i set newPort will not take effect .then i use SqlConnectorConfiguration to set newPort. I don't know other method to set a newPort



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org