This is an automated email from the ASF dual-hosted git repository. ddanielr pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/accumulo.git
commit f7319dac73e73017ca8bdb1e4dc4d5d2bb8f908b Merge: e679321d50 db73ec6bd6 Author: Daniel Roberts ddanielr <[email protected]> AuthorDate: Thu Sep 10 19:11:50 2026 +0000 Merge branch '2.1' .../accumulo/core/clientImpl/bulk/BulkImport.java | 6 +-- .../core/conf/ConfigurationTypeHelper.java | 11 ++++-- .../org/apache/accumulo/core/conf/Property.java | 5 +++ .../core/conf/ConfigurationTypeHelperTest.java | 43 ++++++++++++++++++++++ .../apache/accumulo/server/rpc/TServerUtils.java | 7 +++- 5 files changed, 64 insertions(+), 8 deletions(-) diff --cc core/src/main/java/org/apache/accumulo/core/clientImpl/bulk/BulkImport.java index 44717cf741,be4963c763..e62fce27f5 --- a/core/src/main/java/org/apache/accumulo/core/clientImpl/bulk/BulkImport.java +++ b/core/src/main/java/org/apache/accumulo/core/clientImpl/bulk/BulkImport.java @@@ -19,7 -19,10 +19,8 @@@ package org.apache.accumulo.core.clientImpl.bulk; import static java.nio.charset.StandardCharsets.UTF_8; -import static java.util.concurrent.TimeUnit.MILLISECONDS; -import static java.util.concurrent.TimeUnit.MINUTES; import static java.util.stream.Collectors.groupingBy; + import static org.apache.accumulo.core.conf.ClientProperty.BULK_LOAD_THREADS; import static org.apache.accumulo.core.file.blockfile.impl.CachableBlockFile.pathToCacheId; import static org.apache.accumulo.core.util.Validators.EXISTING_TABLE_NAME; import static org.apache.accumulo.core.util.threads.ThreadPoolNames.BULK_IMPORT_CLIENT_BULK_THREADS_POOL; diff --cc core/src/main/java/org/apache/accumulo/core/conf/ConfigurationTypeHelper.java index 357e4fda37,a15e02f6f1..1e748bb00a --- a/core/src/main/java/org/apache/accumulo/core/conf/ConfigurationTypeHelper.java +++ b/core/src/main/java/org/apache/accumulo/core/conf/ConfigurationTypeHelper.java @@@ -31,12 -27,9 +31,13 @@@ import java.util.Arrays import java.util.Collections; import java.util.EnumSet; import java.util.HashMap; +import java.util.LinkedHashSet; import java.util.Map; + import java.util.Objects; +import java.util.Set; import java.util.concurrent.TimeUnit; +import java.util.function.Predicate; +import java.util.stream.Collectors; import org.apache.accumulo.core.classloader.ClassLoaderUtil; import org.apache.accumulo.core.file.FilePrefix; diff --cc core/src/test/java/org/apache/accumulo/core/conf/ConfigurationTypeHelperTest.java index 9524e5dabb,be3be89f33..f9a61e5a9e --- a/core/src/test/java/org/apache/accumulo/core/conf/ConfigurationTypeHelperTest.java +++ b/core/src/test/java/org/apache/accumulo/core/conf/ConfigurationTypeHelperTest.java @@@ -197,5 -147,49 +197,48 @@@ public class ConfigurationTypeHelperTes ConfigurationTypeHelper.getDropCacheBehindFilePrefixes("NON-IMPORT")); assertThrows(IllegalArgumentException.class, () -> ConfigurationTypeHelper.getDropCacheBehindFilePrefixes("A")); - } + + @Test + public void testGetNumberOfThreads() { + assertEquals(1, ConfigurationTypeHelper.getNumThreads("1")); + assertEquals(2, ConfigurationTypeHelper.getNumThreads("2")); + assertEquals(20, ConfigurationTypeHelper.getNumThreads("20")); + + // availableProcessors can return different results than physical core count on systems that use + // simultaneous multithreading (SMT). + int cores = Runtime.getRuntime().availableProcessors(); + assertEquals(cores * 2, ConfigurationTypeHelper.getNumThreads("2C")); + } + + @Test + public void testGetNumberOfThreadsNullFailure() { + Exception exception = + assertThrows(NullPointerException.class, () -> ConfigurationTypeHelper.getNumThreads(null)); + assertEquals("Threads value cannot be null", exception.getMessage()); + } + + @Test + public void testGetNumberOfThreadsEmptyFailure() { + Exception exception = assertThrows(IllegalArgumentException.class, + () -> ConfigurationTypeHelper.getNumThreads("")); + assertEquals("Threads value cannot be empty or blank", exception.getMessage()); + } + + @Test + public void testGetNumberOfThreadsNegativeOrZeroFailure() { + Exception exception = assertThrows(IllegalArgumentException.class, + () -> ConfigurationTypeHelper.getNumThreads("-1")); + assertEquals("Threads value cannot be less than 1", exception.getMessage()); + exception = assertThrows(IllegalArgumentException.class, + () -> ConfigurationTypeHelper.getNumThreads("0")); + assertEquals("Threads value cannot be less than 1", exception.getMessage()); + } + + @Test + public void testGetNumberOfThreadsDecimalFailure() { + Exception exception = assertThrows(NumberFormatException.class, + () -> ConfigurationTypeHelper.getNumThreads("0.25C")); + assertEquals("For input string: \"0.25\"", exception.getMessage()); + } } diff --cc server/base/src/main/java/org/apache/accumulo/server/rpc/TServerUtils.java index a601eb8a66,48582eb5ab..50fb26418a --- 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 @@@ -20,7 -20,8 +20,8 @@@ package org.apache.accumulo.server.rpc import static com.google.common.base.Preconditions.checkArgument; import static java.util.concurrent.TimeUnit.MILLISECONDS; + import static org.apache.accumulo.core.conf.Property.GENERAL_RPC_SERVER_SELECTOR_THREADS; -import static org.apache.accumulo.core.util.threads.ThreadPoolNames.ACCUMULO_POOL_PREFIX; +import static org.apache.accumulo.core.util.threads.ThreadPoolNames.RPC_POOL; import java.io.IOException; import java.net.InetAddress; @@@ -36,10 -40,11 +37,11 @@@ import java.util.stream.IntStream import javax.net.ssl.SSLServerSocket; +import org.apache.accumulo.core.cli.ServerOpts; import org.apache.accumulo.core.conf.AccumuloConfiguration; + import org.apache.accumulo.core.conf.ConfigurationTypeHelper; import org.apache.accumulo.core.conf.Property; -import org.apache.accumulo.core.conf.PropertyType; -import org.apache.accumulo.core.conf.PropertyType.PortRange; +import org.apache.accumulo.core.data.InstanceId; import org.apache.accumulo.core.metrics.MetricsInfo; import org.apache.accumulo.core.rpc.SslConnectionParams; import org.apache.accumulo.core.rpc.ThriftUtil;
