You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ct...@apache.org on 2021/01/06 16:54:00 UTC

[accumulo] branch main updated: Make ThriftTransportPool logs a little less spammy (#1855)

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

ctubbsii pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/main by this push:
     new 2532a00  Make ThriftTransportPool logs a little less spammy (#1855)
2532a00 is described below

commit 2532a002eb60dee141214938d5088b05438b651d
Author: Christopher Tubbs <ct...@apache.org>
AuthorDate: Wed Jan 6 11:53:47 2021 -0500

    Make ThriftTransportPool logs a little less spammy (#1855)
    
    * Avoid closing already closed transports
    * For TIOStreamTransport, which does not implement a reasonable isOpen()
      method, suppress its log messages during integration testing, so logs
      don't contain spammy errors about closed network connections that are
      expected during testing
---
 .../org/apache/accumulo/core/clientImpl/ThriftTransportPool.java  | 8 +++++---
 test/src/main/resources/log4j2-test.properties                    | 7 +++++++
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/core/src/main/java/org/apache/accumulo/core/clientImpl/ThriftTransportPool.java b/core/src/main/java/org/apache/accumulo/core/clientImpl/ThriftTransportPool.java
index d8884e5..4c0a3b3 100644
--- a/core/src/main/java/org/apache/accumulo/core/clientImpl/ThriftTransportPool.java
+++ b/core/src/main/java/org/apache/accumulo/core/clientImpl/ThriftTransportPool.java
@@ -424,8 +424,8 @@ public class ThriftTransportPool {
 
   static class CachedTTransport extends TTransport {
 
-    private ThriftTransportKey cacheKey;
-    private TTransport wrappedTransport;
+    private final ThriftTransportKey cacheKey;
+    private final TTransport wrappedTransport;
     private boolean sawError = false;
 
     private volatile String ioThreadName = null;
@@ -582,7 +582,9 @@ public class ThriftTransportPool {
     public void close() {
       try {
         ioCount++;
-        wrappedTransport.close();
+        if (wrappedTransport.isOpen()) {
+          wrappedTransport.close();
+        }
       } finally {
         ioCount++;
       }
diff --git a/test/src/main/resources/log4j2-test.properties b/test/src/main/resources/log4j2-test.properties
index b984d8b..428bcf5 100644
--- a/test/src/main/resources/log4j2-test.properties
+++ b/test/src/main/resources/log4j2-test.properties
@@ -136,6 +136,13 @@ logger.34.level = trace
 logger.35.name = org.apache.accumulo.miniclusterImpl.MiniAccumuloClusterImpl
 logger.35.level = info
 
+# This is pointless, as it only ever logs errors closing connections that are
+# already closed, such as when we release a cached thrift transport after the
+# network socket has already disconnected; These can't really be avoided,
+# because TIOStreamTransport does not implement a good isOpen()
+logger.36.name = org.apache.thrift.transport.TIOStreamTransport
+logger.36.level = error
+
 rootLogger.level = debug
 rootLogger.appenderRef.console.ref = STDOUT