From 0976efa783b4544e0acbade641677d4ead80b83d Mon Sep 17 00:00:00 2001 From: Dave Marion Date: Thu, 5 Dec 2024 13:43:03 +0000 Subject: [PATCH] Fix ACCUMULO_POOL_PREFIX usage for Thread pool names Closes #5136 --- .../apache/accumulo/core/util/threads/ThreadPools.java | 8 ++++++-- .../java/org/apache/accumulo/server/rpc/TServerUtils.java | 2 +- .../tserver/compactions/InternalCompactionExecutor.java | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/org/apache/accumulo/core/util/threads/ThreadPools.java b/core/src/main/java/org/apache/accumulo/core/util/threads/ThreadPools.java index b2b0bc02db1..240a41459cb 100644 --- a/core/src/main/java/org/apache/accumulo/core/util/threads/ThreadPools.java +++ b/core/src/main/java/org/apache/accumulo/core/util/threads/ThreadPools.java @@ -399,7 +399,7 @@ public ThreadPoolExecutorBuilder getPoolBuilder(@NonNull final ThreadPoolNames p } /** - * Fet a fluent-style pool builder. + * Get a fluent-style pool builder. * * @param name the pool name - the name trimed and prepended with the ACCUMULO_POOL_PREFIX so that * pool names begin with a consistent prefix. @@ -409,7 +409,11 @@ public ThreadPoolExecutorBuilder getPoolBuilder(@NonNull final String name) { if (trimmed.startsWith(ACCUMULO_POOL_PREFIX.poolName)) { return new ThreadPoolExecutorBuilder(trimmed); } else { - return new ThreadPoolExecutorBuilder(ACCUMULO_POOL_PREFIX.poolName + trimmed); + if (trimmed.startsWith(".")) { + return new ThreadPoolExecutorBuilder(ACCUMULO_POOL_PREFIX.poolName + trimmed); + } else { + return new ThreadPoolExecutorBuilder(ACCUMULO_POOL_PREFIX.poolName + "." + trimmed); + } } } diff --git a/server/base/src/main/java/org/apache/accumulo/server/rpc/TServerUtils.java b/server/base/src/main/java/org/apache/accumulo/server/rpc/TServerUtils.java index d4220ff6ded..22a191a7a68 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/rpc/TServerUtils.java +++ b/server/base/src/main/java/org/apache/accumulo/server/rpc/TServerUtils.java @@ -311,7 +311,7 @@ private static ServerAddress createNonBlockingServer(HostAndPort address, TProce private static ThreadPoolExecutor createSelfResizingThreadPool(final String serverName, final int executorThreads, long threadTimeOut, final AccumuloConfiguration conf, long timeBetweenThreadChecks) { - String poolName = ACCUMULO_POOL_PREFIX.poolName + serverName.toLowerCase() + ".client"; + String poolName = ACCUMULO_POOL_PREFIX.poolName + "." + serverName.toLowerCase() + ".client"; final ThreadPoolExecutor pool = ThreadPools.getServerThreadPools().getPoolBuilder(poolName).numCoreThreads(executorThreads) .withTimeOut(threadTimeOut, MILLISECONDS).enableThreadPoolMetrics().build(); diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/compactions/InternalCompactionExecutor.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/compactions/InternalCompactionExecutor.java index 66002556a3f..618f6463b32 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/compactions/InternalCompactionExecutor.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/compactions/InternalCompactionExecutor.java @@ -208,7 +208,7 @@ public SubmittedJob submit(CompactionServiceId csid, CompactionJob job, Compacta public void setThreads(int numThreads) { ThreadPools.resizePool(threadPool, () -> numThreads, - ACCUMULO_POOL_PREFIX.poolName + "accumulo.pool.compaction." + ceid); + ACCUMULO_POOL_PREFIX.poolName + ".accumulo.pool.compaction." + ceid); } @Override