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 57024c2c76 Fixes to MiniAccumulo based on comments in #5999 (#6062)
57024c2c76 is described below

commit 57024c2c762291c63262b8ad5352dd2e1cfe0caf
Author: Dave Marion <[email protected]>
AuthorDate: Thu Jan 15 18:01:35 2026 -0500

    Fixes to MiniAccumulo based on comments in #5999 (#6062)
---
 .../miniclusterImpl/MiniAccumuloClusterImpl.java   | 13 ++++++--
 .../miniclusterImpl/MiniAccumuloConfigImpl.java    | 36 +++-------------------
 .../accumulo/test/tracing/ScanTracingIT.java       |  2 +-
 3 files changed, 16 insertions(+), 35 deletions(-)

diff --git 
a/minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloClusterImpl.java
 
b/minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloClusterImpl.java
index 36939b5ac7..adda1c65be 100644
--- 
a/minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloClusterImpl.java
+++ 
b/minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloClusterImpl.java
@@ -138,6 +138,10 @@ public class MiniAccumuloClusterImpl implements 
AccumuloCluster {
   private final AtomicReference<MiniDFSCluster> miniDFS = new 
AtomicReference<>();
   private final List<Process> cleanup = new ArrayList<>();
   private final MiniAccumuloClusterControl clusterControl;
+  private final Set<String> defaultJvmOpts =
+      Set.of("-XX:+PerfDisableSharedMem", "-XX:+AlwaysPreTouch");
+  private final Map<String,String> defaultSystemProps =
+      Map.of("apple.awt.UIElement", "true", "java.net.preferIPv4Stack", 
"true");
 
   private boolean initialized = false;
   private ExecutorService executor;
@@ -348,8 +352,13 @@ public class MiniAccumuloClusterImpl implements 
AccumuloCluster {
     String javaBin = javaHome + File.separator + "bin" + File.separator + 
"java";
 
     var basicArgs = Stream.of(javaBin, "-Dproc=" + clazz.getSimpleName());
-    var jvmOptions = Stream.concat(config.getJvmOptions().stream(), 
extraJvmOpts.stream());
-    var systemProps = config.getSystemProperties().entrySet().stream()
+
+    var jvmOptions =
+        Stream.concat(Stream.concat(defaultJvmOpts.stream(), 
config.getJvmOptions().stream()),
+            extraJvmOpts.stream());
+    var systemProps = Stream
+        .concat(defaultSystemProps.entrySet().stream(),
+            config.getSystemProperties().entrySet().stream())
         .map(e -> String.format("-D%s=%s", e.getKey(), e.getValue()));
 
     var classArgs = Stream.of(Main.class.getName(), clazz.getName());
diff --git 
a/minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloConfigImpl.java
 
b/minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloConfigImpl.java
index dbbbf5aecd..8e81809563 100644
--- 
a/minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloConfigImpl.java
+++ 
b/minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloConfigImpl.java
@@ -88,7 +88,7 @@ public class MiniAccumuloConfigImpl {
           MONITOR, Monitor.class, ZOOKEEPER, ZooKeeperServerMain.class, 
TABLET_SERVER,
           TabletServer.class, SCAN_SERVER, ScanServer.class, COMPACTOR, 
Compactor.class));
   private boolean jdwpEnabled = false;
-  private final Map<String,String> systemProperties = new HashMap<>();
+  private Map<String,String> systemProperties = new HashMap<>();
   private final Set<String> jvmOptions = new HashSet<>();
 
   private String instanceName = "miniInstance";
@@ -134,11 +134,6 @@ public class MiniAccumuloConfigImpl {
   public MiniAccumuloConfigImpl(File dir, String rootPassword) {
     this.dir = dir;
     this.rootPassword = rootPassword;
-    // Set default options
-    this.jvmOptions.add("-XX:+PerfDisableSharedMem");
-    this.jvmOptions.add("-XX:+AlwaysPreTouch");
-    this.systemProperties.put("-Dapple.awt.UIElement", "true");
-    this.systemProperties.put("-Djava.net.preferIPv4Stack", "true");
   }
 
   /**
@@ -677,7 +672,7 @@ public class MiniAccumuloConfigImpl {
    * @since 1.6.0
    */
   public void setSystemProperties(Map<String,String> systemProperties) {
-    this.systemProperties.putAll(systemProperties);
+    this.systemProperties = new HashMap<>(systemProperties);
   }
 
   /**
@@ -690,36 +685,13 @@ public class MiniAccumuloConfigImpl {
   }
 
   /**
-   * Add a JVM option to the spawned JVM processes. The default set of JVM 
options contains
-   * '-XX:+PerfDisableSharedMem' and '-XX:+AlwaysPreTouch'
-   *
-   * @param option JVM option
-   * @since 2.1.5
-   */
-  public void addJvmOption(String option) {
-    this.jvmOptions.add(option);
-  }
-
-  /**
-   * Remove an option from the set of JVM options. Only options that match the 
{@code option}
-   * exactly will be removed.
-   *
-   * @param option JVM option
-   * @return true if removed, false if not removed
-   * @since 2.1.5
-   */
-  public boolean removeJvmOption(String option) {
-    return this.jvmOptions.remove(option);
-  }
-
-  /**
-   * Get the set of JVM options
+   * Get the set of JVM options. Changes to this set will affect the 
Configuration
    *
    * @return set of options
    * @since 2.1.5
    */
   public Set<String> getJvmOptions() {
-    return new HashSet<>(jvmOptions);
+    return jvmOptions;
   }
 
   /**
diff --git 
a/test/src/main/java/org/apache/accumulo/test/tracing/ScanTracingIT.java 
b/test/src/main/java/org/apache/accumulo/test/tracing/ScanTracingIT.java
index 898915999d..1bdcd6a1fd 100644
--- a/test/src/main/java/org/apache/accumulo/test/tracing/ScanTracingIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/tracing/ScanTracingIT.java
@@ -74,7 +74,7 @@ class ScanTracingIT extends ConfigurableMacBase {
 
   @Override
   protected void configure(MiniAccumuloConfigImpl cfg, Configuration 
hadoopCoreSite) {
-    getJvmArgs().forEach(cfg::addJvmOption);
+    cfg.getJvmOptions().addAll(getJvmArgs());
     // sized such that full table scans will not fit in the cache
     cfg.setProperty(Property.TSERV_DATACACHE_SIZE.getKey(), "8M");
     cfg.setProperty(Property.TSERV_SCAN_EXECUTORS_PREFIX.getKey() + 
"pool1.threads", "8");

Reply via email to