asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dl...@apache.org
Subject asterixdb git commit: [ASTERIXDB-2009][RT] Improve error reporting in MultiplexedConnection
Date Tue, 01 Aug 2017 20:25:08 GMT
Repository: asterixdb
Updated Branches:
  refs/heads/master 18b8323ee -> 543a4bb72


[ASTERIXDB-2009][RT] Improve error reporting in MultiplexedConnection

- user model changes: no
- storage format changes: no
- interface changes: no

Details:
- retain cause exception and ip address when raising error
  in MultiplexedConnection.waitUntilConnected()

Change-Id: I39c2db3b966dbde5c4c04ba061132a74195fb155
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1910
Reviewed-by: Yingyi Bu <buyingyi@gmail.com>
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
BAD: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>


Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/543a4bb7
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/543a4bb7
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/543a4bb7

Branch: refs/heads/master
Commit: 543a4bb729daae8748a07bc8aebabbfbc0e0f46b
Parents: 18b8323
Author: Dmitry Lychagin <dmitry.lychagin@couchbase.com>
Authored: Mon Jul 31 16:54:32 2017 -0700
Committer: Dmitry Lychagin <dmitry.lychagin@couchbase.com>
Committed: Tue Aug 1 13:24:50 2017 -0700

----------------------------------------------------------------------
 .../hyracks/net/protocols/muxdemux/MultiplexedConnection.java | 5 +++--
 .../org/apache/hyracks/net/protocols/muxdemux/MuxDemux.java   | 4 ++--
 .../hyracks/net/protocols/tcp/ITCPConnectionListener.java     | 3 ++-
 .../org/apache/hyracks/net/protocols/tcp/TCPEndpoint.java     | 7 +++----
 4 files changed, 10 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/543a4bb7/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/muxdemux/MultiplexedConnection.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/muxdemux/MultiplexedConnection.java
b/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/muxdemux/MultiplexedConnection.java
index ad8aabd..8c54c65 100644
--- a/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/muxdemux/MultiplexedConnection.java
+++ b/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/muxdemux/MultiplexedConnection.java
@@ -110,8 +110,9 @@ public class MultiplexedConnection implements ITCPConnectionEventListener
{
         notifyAll();
     }
 
-    synchronized void setConnectionFailure() {
+    synchronized void setConnectionFailure(Exception e) {
         this.connectionFailure = true;
+        this.error = e;
         notifyAll();
     }
 
@@ -120,7 +121,7 @@ public class MultiplexedConnection implements ITCPConnectionEventListener
{
             wait();
         }
         if (connectionFailure) {
-            throw new NetException("Connection failure");
+            throw new NetException("Connection failure", error);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/543a4bb7/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/muxdemux/MuxDemux.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/muxdemux/MuxDemux.java
b/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/muxdemux/MuxDemux.java
index 7e6c8d7..f6261da 100644
--- a/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/muxdemux/MuxDemux.java
+++ b/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/muxdemux/MuxDemux.java
@@ -92,7 +92,7 @@ public class MuxDemux {
             }
 
             @Override
-            public void connectionFailure(InetSocketAddress remoteAddress) {
+            public void connectionFailure(InetSocketAddress remoteAddress, IOException error)
{
                 MultiplexedConnection mConn;
                 synchronized (MuxDemux.this) {
                     mConn = connectionMap.get(remoteAddress);
@@ -100,7 +100,7 @@ public class MuxDemux {
                     int nConnectionAttempts = mConn.getConnectionAttempts();
                     if (nConnectionAttempts > MuxDemux.this.maxConnectionAttempts) {
                         connectionMap.remove(remoteAddress);
-                        mConn.setConnectionFailure();
+                        mConn.setConnectionFailure(new IOException(remoteAddress.toString()
+ ": " + error, error));
                     } else {
                         mConn.setConnectionAttempts(nConnectionAttempts + 1);
                         tcpEndpoint.initiateConnection(remoteAddress);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/543a4bb7/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/tcp/ITCPConnectionListener.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/tcp/ITCPConnectionListener.java
b/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/tcp/ITCPConnectionListener.java
index 9fe0421..b801cd3 100644
--- a/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/tcp/ITCPConnectionListener.java
+++ b/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/tcp/ITCPConnectionListener.java
@@ -18,6 +18,7 @@
  */
 package org.apache.hyracks.net.protocols.tcp;
 
+import java.io.IOException;
 import java.net.InetSocketAddress;
 
 public interface ITCPConnectionListener {
@@ -25,5 +26,5 @@ public interface ITCPConnectionListener {
 
     public void connectionEstablished(TCPConnection connection);
 
-    public void connectionFailure(InetSocketAddress remoteAddress);
+    public void connectionFailure(InetSocketAddress remoteAddress, IOException error);
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/543a4bb7/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/tcp/TCPEndpoint.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/tcp/TCPEndpoint.java
b/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/tcp/TCPEndpoint.java
index 41e0dd2..52f4c30 100644
--- a/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/tcp/TCPEndpoint.java
+++ b/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/tcp/TCPEndpoint.java
@@ -132,7 +132,7 @@ public class TCPEndpoint {
                             } catch (IOException e) {
                                 failure = true;
                                 synchronized (connectionListener) {
-                                    connectionListener.connectionFailure(address);
+                                    connectionListener.connectionFailure(address, e);
                                 }
                             }
                             if (!failure) {
@@ -188,11 +188,10 @@ public class TCPEndpoint {
                                 boolean finishConnect = false;
                                 try {
                                     finishConnect = channel.finishConnect();
-                                } catch (Exception e) {
-                                    e.printStackTrace();
+                                } catch (IOException e) {
                                     key.cancel();
                                     synchronized (connectionListener) {
-                                        connectionListener.connectionFailure((InetSocketAddress)
key.attachment());
+                                        connectionListener.connectionFailure((InetSocketAddress)
key.attachment(), e);
                                     }
                                 }
                                 if (finishConnect) {


Mime
View raw message