You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by GitBox <gi...@apache.org> on 2020/12/01 14:49:15 UTC

[GitHub] [geode] alb3rtobr commented on a change in pull request #5600: GEODE-8202: Two-step serial gw sender threads start

alb3rtobr commented on a change in pull request #5600:
URL: https://github.com/apache/geode/pull/5600#discussion_r533469342



##########
File path: geode-wan/src/main/java/org/apache/geode/internal/cache/wan/GatewaySenderEventRemoteDispatcher.java
##########
@@ -348,11 +349,56 @@ public void destroyConnection() {
     }
   }
 
+  Connection retryInitializeConnection(Connection con) {
+    final boolean isDebugEnabled = logger.isDebugEnabled();
+    ServerLocation server = this.sender.getServerLocation();
+    String connectedServerId = con.getEndpoint().getMemberId().getUniqueId();
+    String expectedServerId = this.processor.getExpectedReceiverUniqueId();
+    boolean connectedToExpectedReceiver = connectedServerId.equals(expectedServerId);
+    if (expectedServerId.equals("")) {
+      if (isDebugEnabled) {
+        logger.debug("First dispatcher connected to endpoint " + connectedServerId);
+      }
+      this.processor.setExpectedReceiverUniqueId(connectedServerId);
+      connectedToExpectedReceiver = true;
+    }
+    int attempt = 0;
+    final int maxAttempts = 5;

Review comment:
       If several receivers are sharing the same ip and port, the connection will be assigned randomly by an external proxy or load balancer. Its true that using this fix value is not the best option... If for example we have 5 receivers, we could spend all the connection retries without reaching the desired receiver.
   Maybe I could increment the value of `maxAttempt` when a connection to a wrong receiver is obtained and its the first time we reach that wrong receiver. This will cause that `maxAttempt` value is dependent on the number of receivers.




----------------------------------------------------------------
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.

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