Repository: asterixdb
Updated Branches:
  refs/heads/master b944080fc -> 2498d28f0


[NO ISSUE][LOG] Include destination IP in thread name on push back

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

Details:
- In certain cases, we noticed that threads of certain jobs are
  waiting on the network boundaries to send tuples.
- In that case and in a big cluster, it is difficult to tell which
  node is pushing back.
- To make this easy, we include the IP of the receiving node
  in the thread name.

Change-Id: I81b48cb7a79de0a37f2171a1bd3b82141f89b49d
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2929
Sonar-Qube: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Contrib: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Reviewed-by: Murtadha Hubail <mhub...@apache.org>
Integration-Tests: Jenkins <jenk...@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/2498d28f
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/2498d28f
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/2498d28f

Branch: refs/heads/master
Commit: 2498d28f0584d6ab002625417622be429f5c8131
Parents: b944080
Author: Abdullah Alamoudi <bamou...@gmail.com>
Authored: Mon Aug 27 13:42:21 2018 -0700
Committer: abdullah alamoudi <bamou...@gmail.com>
Committed: Mon Aug 27 18:48:53 2018 -0700

----------------------------------------------------------------------
 .../hyracks/comm/channels/NetworkOutputChannel.java     | 12 +++++++++++-
 .../net/protocols/muxdemux/ChannelControlBlock.java     |  5 +++++
 .../hyracks/net/protocols/muxdemux/ChannelSet.java      |  4 ++++
 .../net/protocols/muxdemux/MultiplexedConnection.java   |  5 +++++
 4 files changed, 25 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2498d28f/hyracks-fullstack/hyracks/hyracks-comm/src/main/java/org/apache/hyracks/comm/channels/NetworkOutputChannel.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-comm/src/main/java/org/apache/hyracks/comm/channels/NetworkOutputChannel.java
 
b/hyracks-fullstack/hyracks/hyracks-comm/src/main/java/org/apache/hyracks/comm/channels/NetworkOutputChannel.java
index 334fb5c..261e7c4 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-comm/src/main/java/org/apache/hyracks/comm/channels/NetworkOutputChannel.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-comm/src/main/java/org/apache/hyracks/comm/channels/NetworkOutputChannel.java
@@ -18,9 +18,11 @@
  */
 package org.apache.hyracks.comm.channels;
 
+import java.net.InetSocketAddress;
 import java.nio.ByteBuffer;
 import java.util.ArrayDeque;
 import java.util.Deque;
+import java.util.Objects;
 
 import org.apache.hyracks.api.comm.IBufferAcceptor;
 import org.apache.hyracks.api.comm.IFrameWriter;
@@ -75,7 +77,15 @@ public class NetworkOutputChannel implements IFrameWriter {
                         break;
                     }
                     try {
-                        wait();
+                        InetSocketAddress remoteAddress = 
ccb.getRemoteAddress();
+                        String nameBefore = Thread.currentThread().getName();
+                        try {
+                            Thread.currentThread()
+                                    .setName(nameBefore + ":SendingTo(" + 
Objects.toString(remoteAddress) + ")");
+                            wait();
+                        } finally {
+                            Thread.currentThread().setName(nameBefore);
+                        }
                     } catch (InterruptedException e) {
                         Thread.currentThread().interrupt();
                         throw HyracksDataException.create(e);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2498d28f/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/muxdemux/ChannelControlBlock.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/muxdemux/ChannelControlBlock.java
 
b/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/muxdemux/ChannelControlBlock.java
index 998acfb..f7ef2aa 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/muxdemux/ChannelControlBlock.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/muxdemux/ChannelControlBlock.java
@@ -19,6 +19,7 @@
 package org.apache.hyracks.net.protocols.muxdemux;
 
 import java.io.IOException;
+import java.net.InetSocketAddress;
 import java.nio.channels.SocketChannel;
 import java.util.concurrent.atomic.AtomicBoolean;
 
@@ -163,4 +164,8 @@ public class ChannelControlBlock implements 
IChannelControlBlock {
                 + " remoteClose: " + remoteClose + " remoteCloseAck:" + 
remoteCloseAck + " readCredits: "
                 + ri.getCredits() + " writeCredits: " + wi.getCredits() + "]";
     }
+
+    public InetSocketAddress getRemoteAddress() {
+        return cSet.getMultiplexedConnection().getRemoteAddress();
+    }
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2498d28f/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/muxdemux/ChannelSet.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/muxdemux/ChannelSet.java
 
b/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/muxdemux/ChannelSet.java
index 31a37ef..f5cdf2c 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/muxdemux/ChannelSet.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/muxdemux/ChannelSet.java
@@ -239,4 +239,8 @@ public class ChannelSet {
             ccbArray = Arrays.copyOf(ccbArray, ccbArray.length * 2);
         }
     }
+
+    public MultiplexedConnection getMultiplexedConnection() {
+        return mConn;
+    }
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2498d28f/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 b6a392e..4c3836a 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
@@ -19,6 +19,7 @@
 package org.apache.hyracks.net.protocols.muxdemux;
 
 import java.io.IOException;
+import java.net.InetSocketAddress;
 import java.nio.ByteBuffer;
 import java.nio.channels.SelectionKey;
 import java.nio.channels.SocketChannel;
@@ -437,4 +438,8 @@ public class MultiplexedConnection implements 
ITCPConnectionEventListener {
             }
         }
     }
+
+    public InetSocketAddress getRemoteAddress() {
+        return tcpConnection == null ? null : tcpConnection.getRemoteAddress();
+    }
 }
\ No newline at end of file

Reply via email to