Jelajahi Sumber

HDFS-17028. RBF: Optimize debug logs of class ConnectionPool and other related class. (#5694). Contributed by farmmamba.

Reviewed-by: Inigo Goiri <inigoiri@apache.org>
Signed-off-by: Ayush Saxena <ayushsaxena@apache.org>
hfutatzhanghb 2 tahun lalu
induk
melakukan
2243cfd225

+ 6 - 3
hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/ConnectionContext.java

@@ -150,8 +150,8 @@ public class ConnectionContext {
       // this is an erroneous case, but we have to close the connection
       // anyway since there will be connection leak if we don't do so
       // the connection has been moved out of the pool
-      LOG.error("Active connection with {} handlers will be closed",
-          this.numThreads);
+      LOG.error("Active connection with {} handlers will be closed, ConnectionContext is {}",
+          this.numThreads, this);
     }
     this.closed = true;
     Object proxy = this.client.getProxy();
@@ -170,7 +170,10 @@ public class ConnectionContext {
     Class<?> clazz = proxy.getClass();
 
     StringBuilder sb = new StringBuilder();
-    sb.append(clazz.getSimpleName())
+    sb.append("hashcode:")
+        .append(hashCode())
+        .append(" ")
+        .append(clazz.getSimpleName())
         .append("@")
         .append(addr)
         .append("x")

+ 1 - 1
hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/ConnectionManager.java

@@ -482,7 +482,7 @@ public class ConnectionManager {
                   pool.getMaxSize(), pool);
             }
           } catch (IOException e) {
-            LOG.error("Cannot create a new connection", e);
+            LOG.error("Cannot create a new connection for {} {}", pool, e);
           }
         } catch (InterruptedException e) {
           LOG.error("The connection creator was interrupted");

+ 2 - 2
hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/ConnectionPool.java

@@ -286,8 +286,8 @@ public class ConnectionPool {
       }
       this.connections = tmpConnections;
     }
-    LOG.debug("Expected to remove {} connection and actually removed {} connections",
-        num, removed.size());
+    LOG.debug("Expected to remove {} connection and actually removed {} connections "
+        + "for connectionPool: {}", num, removed.size(), connectionPoolId);
     return removed;
   }