This is an automated email from the ASF dual-hosted git repository. dlmarion pushed a commit to branch 2.1 in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/2.1 by this push: new 18b745466e Added compactors_per_host to accumulo-cluster script (#4329) 18b745466e is described below commit 18b745466eee10c41f72012908b867005ca89881 Author: Dave Marion <dlmar...@apache.org> AuthorDate: Mon Mar 4 07:22:46 2024 -0500 Added compactors_per_host to accumulo-cluster script (#4329) --- assemble/bin/accumulo-cluster | 10 +++++++++- .../accumulo/core/conf/cluster/ClusterConfigParser.java | 5 ++++- .../accumulo/core/conf/cluster/ClusterConfigParserTest.java | 11 ++++++++--- .../core/conf/cluster/cluster-with-optional-services.yaml | 3 ++- 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/assemble/bin/accumulo-cluster b/assemble/bin/accumulo-cluster index c9936cb78b..5dd9de7e4e 100755 --- a/assemble/bin/accumulo-cluster +++ b/assemble/bin/accumulo-cluster @@ -119,6 +119,11 @@ function parse_config { if [[ -z $NUM_SSERVERS ]]; then echo "INFO: ${NUM_SSERVERS} sservers will be started per host" fi + + if [[ -z $NUM_COMPACTORS ]]; then + echo "INFO: ${NUM_COMPACTORS} compactors will be started per host" + fi + } function control_service() { @@ -130,6 +135,7 @@ function control_service() { last_instance_id=1 [[ $service == "tserver" ]] && last_instance_id=${NUM_TSERVERS:-1} [[ $service == "sserver" ]] && last_instance_id=${NUM_SSERVERS:-1} + [[ $service == "compactor" ]] && last_instance_id=${NUM_COMPACTORS:-1} for ((inst_id = 1; inst_id <= last_instance_id; inst_id++)); do ACCUMULO_SERVICE_INSTANCE="" @@ -510,10 +516,12 @@ tserver: # to start on each host. If the following variables are not set, then they default to 1. # If the environment variable NUM_TSERVERS is set when running accumulo_cluster # then its value will override what is set in this file for tservers_per_host. Likewise if -# NUM_SSERVERS is set then it will override sservers_per_host. +# NUM_SSERVERS or NUM_COMPACTORS are set then it will override sservers_per_host and +# compactors_per_host. # tservers_per_host: 1 sservers_per_host: 1 +compactors_per_host: 1 EOF ;; diff --git a/core/src/main/java/org/apache/accumulo/core/conf/cluster/ClusterConfigParser.java b/core/src/main/java/org/apache/accumulo/core/conf/cluster/ClusterConfigParser.java index 4f41cbef3e..5790fa7fd3 100644 --- a/core/src/main/java/org/apache/accumulo/core/conf/cluster/ClusterConfigParser.java +++ b/core/src/main/java/org/apache/accumulo/core/conf/cluster/ClusterConfigParser.java @@ -42,7 +42,7 @@ public class ClusterConfigParser { private static final String[] SECTIONS = new String[] {"manager", "monitor", "gc", "tserver"}; private static final Set<String> VALID_CONFIG_KEYS = Set.of("manager", "monitor", "gc", "tserver", - "tservers_per_host", "sservers_per_host", "compaction.coordinator"); + "tservers_per_host", "sservers_per_host", "compaction.coordinator", "compactors_per_host"); private static final Set<String> VALID_CONFIG_PREFIXES = Set.of("compaction.compactor.", "sserver."); @@ -150,6 +150,9 @@ public class ClusterConfigParser { String numSservers = config.getOrDefault("sservers_per_host", "1"); out.print("NUM_SSERVERS=\"${NUM_SSERVERS:=" + numSservers + "}\"\n"); + String numCompactors = config.getOrDefault("compactors_per_host", "1"); + out.print("NUM_COMPACTORS=\"${NUM_COMPACTORS:=" + numCompactors + "}\"\n"); + out.flush(); } diff --git a/core/src/test/java/org/apache/accumulo/core/conf/cluster/ClusterConfigParserTest.java b/core/src/test/java/org/apache/accumulo/core/conf/cluster/ClusterConfigParserTest.java index ef2c2382bc..1410dc569a 100644 --- a/core/src/test/java/org/apache/accumulo/core/conf/cluster/ClusterConfigParserTest.java +++ b/core/src/test/java/org/apache/accumulo/core/conf/cluster/ClusterConfigParserTest.java @@ -73,6 +73,7 @@ public class ClusterConfigParserTest { assertFalse(contents.containsKey("compaction.compactor.q2")); assertFalse(contents.containsKey("tservers_per_host")); assertFalse(contents.containsKey("sservers_per_host")); + assertFalse(contents.containsKey("compactors_per_host")); } @Test @@ -84,7 +85,7 @@ public class ClusterConfigParserTest { Map<String,String> contents = ClusterConfigParser.parseConfiguration(new File(configFile.toURI()).getAbsolutePath()); - assertEquals(12, contents.size()); + assertEquals(13, contents.size()); assertTrue(contents.containsKey("manager")); assertEquals("localhost1 localhost2", contents.get("manager")); assertTrue(contents.containsKey("monitor")); @@ -111,7 +112,9 @@ public class ClusterConfigParserTest { assertTrue(contents.containsKey("tservers_per_host")); assertEquals("2", contents.get("tservers_per_host")); assertTrue(contents.containsKey("sservers_per_host")); - assertEquals("1", contents.get("sservers_per_host")); + assertEquals("2", contents.get("sservers_per_host")); + assertTrue(contents.containsKey("compactors_per_host")); + assertEquals("3", contents.get("compactors_per_host")); } @Test @@ -170,6 +173,7 @@ public class ClusterConfigParserTest { expected.put("TSERVER_HOSTS", "localhost1 localhost2 localhost3 localhost4"); expected.put("NUM_TSERVERS", "${NUM_TSERVERS:=1}"); expected.put("NUM_SSERVERS", "${NUM_SSERVERS:=1}"); + expected.put("NUM_COMPACTORS", "${NUM_COMPACTORS:=1}"); expected.replaceAll((k, v) -> '"' + v + '"'); @@ -227,7 +231,8 @@ public class ClusterConfigParserTest { expected.put("SSERVER_HOSTS_highmem", "hmvm1 hmvm2 hmvm3"); expected.put("SSERVER_HOSTS_cheap", "burstyvm1 burstyvm2"); expected.put("NUM_TSERVERS", "${NUM_TSERVERS:=2}"); - expected.put("NUM_SSERVERS", "${NUM_SSERVERS:=1}"); + expected.put("NUM_SSERVERS", "${NUM_SSERVERS:=2}"); + expected.put("NUM_COMPACTORS", "${NUM_COMPACTORS:=3}"); expected.replaceAll((k, v) -> { return '"' + v + '"'; diff --git a/core/src/test/resources/org/apache/accumulo/core/conf/cluster/cluster-with-optional-services.yaml b/core/src/test/resources/org/apache/accumulo/core/conf/cluster/cluster-with-optional-services.yaml index 950cfa8ee5..104857951b 100644 --- a/core/src/test/resources/org/apache/accumulo/core/conf/cluster/cluster-with-optional-services.yaml +++ b/core/src/test/resources/org/apache/accumulo/core/conf/cluster/cluster-with-optional-services.yaml @@ -59,4 +59,5 @@ compaction: - localhost4 tservers_per_host: 2 -sservers_per_host: 1 +sservers_per_host: 2 +compactors_per_host: 3