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

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

commit 5e4df70d1de54463fa349db84f20001dc7e2a03e
Author: Michael Blow <[email protected]>
AuthorDate: Fri Feb 14 15:31:30 2020 -0500

    [NO ISSUE][NET] Preemptively re-resolve INetSocketAddresses when replica 
connection is unhealthy
    
    Change-Id: I64386b9a1e63d2b2ab792628dc4348a30590cc6f
    Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/5043
    Reviewed-by: Michael Blow <[email protected]>
    Reviewed-by: Murtadha Hubail <[email protected]>
    Integration-Tests: Jenkins <[email protected]>
    Tested-by: Jenkins <[email protected]>
---
 .../org/apache/asterix/replication/api/PartitionReplica.java  |  9 +++------
 .../asterix/replication/api/ReplicationDestination.java       | 11 ++++-------
 2 files changed, 7 insertions(+), 13 deletions(-)

diff --git 
a/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/api/PartitionReplica.java
 
b/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/api/PartitionReplica.java
index f2d2496..3226299 100644
--- 
a/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/api/PartitionReplica.java
+++ 
b/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/api/PartitionReplica.java
@@ -106,12 +106,9 @@ public class PartitionReplica implements IPartitionReplica 
{
     }
 
     private void establishReplicaConnection() throws IOException {
-        try {
-            sc = ReplicationProtocol.establishReplicaConnection(appCtx, 
id.getLocation());
-        } catch (Exception e) {
-            // try to re-resolve the address, in case our replica has had his 
IP address updated
-            sc = ReplicationProtocol.establishReplicaConnection(appCtx, 
id.refreshLocation());
-        }
+        // try to re-resolve the address, in case our replica has had his IP 
address updated, and that is why the
+        // connection is unhealthy...
+        sc = ReplicationProtocol.establishReplicaConnection(appCtx, 
id.refreshLocation());
     }
 
     public synchronized void close() {
diff --git 
a/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/api/ReplicationDestination.java
 
b/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/api/ReplicationDestination.java
index 782a801..d803756 100644
--- 
a/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/api/ReplicationDestination.java
+++ 
b/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/api/ReplicationDestination.java
@@ -94,13 +94,10 @@ public class ReplicationDestination implements 
IReplicationDestination {
     }
 
     protected void establishReplicaConnection(INcApplicationContext appCtx) 
throws IOException {
-        try {
-            logRepChannel = 
ReplicationProtocol.establishReplicaConnection(appCtx, resolvedLocation);
-        } catch (Exception e) {
-            // try to re-resolve the address, in case our replica has had his 
IP address updated
-            resolvedLocation = NetworkUtil.refresh(resolvedLocation);
-            logRepChannel = 
ReplicationProtocol.establishReplicaConnection(appCtx, resolvedLocation);
-        }
+        // try to re-resolve the address, in case our replica has had his IP 
address updated, and that is why
+        // the connection is unhealthy...
+        resolvedLocation = NetworkUtil.refresh(resolvedLocation);
+        logRepChannel = ReplicationProtocol.establishReplicaConnection(appCtx, 
resolvedLocation);
     }
 
     private synchronized void closeLogReplicationChannel() {

Reply via email to