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 09e51978d3 Fix ThriftTransportPool client idle timeout default (#2629) 09e51978d3 is described below commit 09e51978d37b48ec9fe0a5482390cf983a0beed7 Author: Christopher Tubbs <ctubb...@apache.org> AuthorDate: Wed Apr 13 21:59:41 2022 -0400 Fix ThriftTransportPool client idle timeout default (#2629) * Create new client-side property for ThriftTransportPool's idle transport timeout. This allows the default value for clients to be configured independently of the default value for servers. * Set default value for clients back to 3 seconds, like it was hard-coded prior to the changes in #2612 * Fix debug logging of the transport pool idle time value This fixes #2626 --- .../java/org/apache/accumulo/core/clientImpl/ClientContext.java | 7 ++++++- .../org/apache/accumulo/core/clientImpl/ThriftTransportPool.java | 2 +- .../main/java/org/apache/accumulo/core/conf/ClientProperty.java | 5 +++++ .../src/main/java/org/apache/accumulo/server/ServerContext.java | 5 +++++ 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/apache/accumulo/core/clientImpl/ClientContext.java b/core/src/main/java/org/apache/accumulo/core/clientImpl/ClientContext.java index 02f6e8a243..08a852c3f0 100644 --- a/core/src/main/java/org/apache/accumulo/core/clientImpl/ClientContext.java +++ b/core/src/main/java/org/apache/accumulo/core/clientImpl/ClientContext.java @@ -1014,10 +1014,15 @@ public class ClientContext implements AccumuloClient { return zooReader; } + protected long getTransportPoolMaxAgeMillis() { + ensureOpen(); + return ClientProperty.RPC_TRANSPORT_IDLE_TIMEOUT.getTimeInMillis(getProperties()); + } + public synchronized ThriftTransportPool getTransportPool() { ensureOpen(); if (thriftTransportPool == null) { - thriftTransportPool = ThriftTransportPool.startNew(this::getClientTimeoutInMillis); + thriftTransportPool = ThriftTransportPool.startNew(this::getTransportPoolMaxAgeMillis); } return thriftTransportPool; } 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 8b53e02e7c..7dd9a8cde0 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 @@ -106,7 +106,7 @@ public class ThriftTransportPool { */ static ThriftTransportPool startNew(LongSupplier maxAgeMillis) { var pool = new ThriftTransportPool(maxAgeMillis); - log.debug("Set thrift transport pool idle time to {}", maxAgeMillis); + log.debug("Set thrift transport pool idle time to {}ms", maxAgeMillis.getAsLong()); pool.checkThread.start(); return pool; } diff --git a/core/src/main/java/org/apache/accumulo/core/conf/ClientProperty.java b/core/src/main/java/org/apache/accumulo/core/conf/ClientProperty.java index 306e4490ed..b20f6ac51d 100644 --- a/core/src/main/java/org/apache/accumulo/core/conf/ClientProperty.java +++ b/core/src/main/java/org/apache/accumulo/core/conf/ClientProperty.java @@ -122,6 +122,11 @@ public enum ClientProperty { SASL_KERBEROS_SERVER_PRIMARY("sasl.kerberos.server.primary", "accumulo", "Kerberos principal/primary that Accumulo servers use to login"), + // RPC + RPC_TRANSPORT_IDLE_TIMEOUT("rpc.transport.idle.timeout", "3s", PropertyType.TIMEDURATION, + "The maximum duration to leave idle transports open in the client's transport pool", "2.1.0", + false), + // Trace @Deprecated(since = "2.1.0", forRemoval = true) TRACE_SPAN_RECEIVERS("trace.span.receivers", "org.apache.accumulo.tracer.ZooTraceClient", diff --git a/server/base/src/main/java/org/apache/accumulo/server/ServerContext.java b/server/base/src/main/java/org/apache/accumulo/server/ServerContext.java index 16b841ef7c..4dc56a6a37 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/ServerContext.java +++ b/server/base/src/main/java/org/apache/accumulo/server/ServerContext.java @@ -461,4 +461,9 @@ public class ServerContext extends ClientContext { return sharedScheduledThreadPool; } + @Override + protected long getTransportPoolMaxAgeMillis() { + return getClientTimeoutInMillis(); + } + }