-
Notifications
You must be signed in to change notification settings - Fork 476
Make Mini Accumulo hardcoded JVM options mutable #5999
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,10 +30,12 @@ | |
| import java.io.IOException; | ||
| import java.util.EnumMap; | ||
| import java.util.HashMap; | ||
| import java.util.HashSet; | ||
| import java.util.Iterator; | ||
| import java.util.Map; | ||
| import java.util.Map.Entry; | ||
| import java.util.Objects; | ||
| import java.util.Set; | ||
| import java.util.function.Consumer; | ||
|
|
||
| import org.apache.accumulo.compactor.Compactor; | ||
|
|
@@ -86,7 +88,8 @@ 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 Map<String,String> systemProperties = new HashMap<>(); | ||
| private final Map<String,String> systemProperties = new HashMap<>(); | ||
| private final Set<String> jvmOptions = new HashSet<>(); | ||
|
|
||
| private String instanceName = "miniInstance"; | ||
| private String rootUserName = "root"; | ||
|
|
@@ -131,6 +134,11 @@ 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"); | ||
|
Comment on lines
+140
to
+141
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These were moved from the hard-coded set into the system properties set that the user inserts. This has two problems:
|
||
| } | ||
|
|
||
| /** | ||
|
|
@@ -669,7 +677,7 @@ public File getClientPropsFile() { | |
| * @since 1.6.0 | ||
| */ | ||
| public void setSystemProperties(Map<String,String> systemProperties) { | ||
| this.systemProperties = new HashMap<>(systemProperties); | ||
| this.systemProperties.putAll(systemProperties); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This changes behavior. "set" as the verb means "use these and only these", but this changes behavior to "put", which appends, rather than replaces. |
||
| } | ||
|
|
||
| /** | ||
|
|
@@ -681,6 +689,39 @@ public Map<String,String> getSystemProperties() { | |
| return new HashMap<>(systemProperties); | ||
| } | ||
|
|
||
| /** | ||
| * 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 | ||
dlmarion marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| */ | ||
| public void addJvmOption(String option) { | ||
| this.jvmOptions.add(option); | ||
| } | ||
dlmarion marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| /** | ||
| * 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) { | ||
dlmarion marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| return this.jvmOptions.remove(option); | ||
| } | ||
|
|
||
| /** | ||
| * Get the set of JVM options | ||
| * | ||
| * @return set of options | ||
| * @since 2.1.5 | ||
| */ | ||
| public Set<String> getJvmOptions() { | ||
| return new HashSet<>(jvmOptions); | ||
| } | ||
|
Comment on lines
+715
to
+723
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We probably don't need 3 separate methods for this Impl class. We can just expose the underlying jvmOptions, and mutate them, rather than having separate getter, setter, and remover methods. Or, we could reduce it to two by using a mutateJvmOptions method or similar. In any case, this seems like a heavy-weight change to an internal API for something that is almost never used. |
||
|
|
||
| /** | ||
| * Gets the classpath elements to use when spawning processes. | ||
| * | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This hard-coded set was intentionally set after all user-specified options, because they were intended to be not override-able.
I think for some of these (perhaps all of them), it's okay to be able to override, but they should be able to be overridden by just adding their opposite, as in
-XX:-PerfDisableSharedMem(so long as the override occurs later in the command line).I think the
-XXargs should be override-able, but the-Dones here were intended to be not overrideable, because we didn't want the user to have to specify them each time they usedsetProperties(), becausesetProperties()was intended to replace, not append, to properties.