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

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


The following commit(s) were added to refs/heads/master by this push:
     new ad32f5c34 [rpc] add local address into connection negotiation trace
ad32f5c34 is described below

commit ad32f5c34734f88d11029dba0ced57979dfc29b9
Author: Alexey Serbin <[email protected]>
AuthorDate: Wed Oct 11 20:20:11 2023 -0700

    [rpc] add local address into connection negotiation trace
    
    I found it would be easier for RPC connection negotiation
    troubleshooting to have the information on both the remote and the local
    addresses of the connection in the negotiation trace.  That would help
    to remove ambiguity when there are multiple Kudu clients running at
    the same node from which RPC connections are initiated, so now it's
    easier to find corresponding pairs of negotiation traces in client- and
    server-side logs.
    
    I didn't add any tests, but I manually verified that the information
    on the local address is present in the connection negotiation traces,
    for example:
    
      1011 19:59:40.775119 (+     0us) reactor.cc:618] Submitting negotiation 
task for client connection to 127.206.101.1:46339 (local address 
127.0.0.1:47450)
    
      1011 19:59:40.775135 (+     0us) reactor.cc:618] Submitting negotiation 
task for server connection from 127.0.0.1:47450 (local address 
127.206.101.1:46339)
    
    Change-Id: I2907e9b4fd502e2139c989c940d2f1ac55d23219
    Reviewed-on: http://gerrit.cloudera.org:8080/20564
    Tested-by: Kudu Jenkins
    Reviewed-by: Abhishek Chennaka <[email protected]>
---
 src/kudu/rpc/reactor.cc | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/kudu/rpc/reactor.cc b/src/kudu/rpc/reactor.cc
index 4f276ea74..64ef18861 100644
--- a/src/kudu/rpc/reactor.cc
+++ b/src/kudu/rpc/reactor.cc
@@ -27,6 +27,7 @@
 #include <mutex>
 #include <ostream>
 #include <string>
+#include <type_traits>
 #include <utility>
 
 #include <boost/intrusive/list.hpp>
@@ -50,6 +51,7 @@
 #include "kudu/util/countdown_latch.h"
 #include "kudu/util/debug/sanitizer_scopes.h"
 #include "kudu/util/flag_tags.h"
+#include "kudu/util/flags.h"
 #include "kudu/util/metrics.h"
 #include "kudu/util/monotime.h"
 #include "kudu/util/net/sockaddr.h"
@@ -606,7 +608,16 @@ Status ReactorThread::StartConnectionNegotiation(const 
scoped_refptr<Connection>
 
   scoped_refptr<Trace> trace(new Trace());
   ADOPT_TRACE(trace.get());
-  TRACE("Submitting negotiation task for $0", conn->ToString());
+  string local_addr_str;
+  {
+    Sockaddr local_addr;
+    if (auto s = conn->GetLocalAddress(&local_addr); PREDICT_FALSE(!s.ok())) {
+      WARN_NOT_OK(s, "failed to retrieve information on local address");
+    } else {
+      local_addr_str = Substitute(" (local address $0)", 
local_addr.ToString());
+    }
+  }
+  TRACE("Submitting negotiation task for $0$1", conn->ToString(), 
local_addr_str);
   auto authentication = reactor()->messenger()->authentication();
   auto encryption = reactor()->messenger()->encryption();
   auto loopback_encryption = reactor()->messenger()->loopback_encryption();

Reply via email to