Skip to content

Conversation

@dlmarion
Copy link
Contributor

@dlmarion dlmarion commented Dec 3, 2025

Processes spawned by MiniAccumuloCluster have a pre-configured, but not mutable, set of JVM options. Specifically they are '-XX:+PerfDisableSharedMem' and '-XX:+AlwaysPreTouch'. This change makes the set of JVM options configurable.

Processes spawned by MiniAccumuloCluster have a pre-configured,
but not mutable, set of JVM options. Specifically they are
'-XX:+PerfDisableSharedMem' and '-XX:+AlwaysPreTouch'. This
change makes the set of JVM options configurable.
@dlmarion dlmarion added this to the 2.1.5 milestone Dec 3, 2025
@dlmarion dlmarion self-assigned this Dec 3, 2025
Copy link
Member

@kevinrr888 kevinrr888 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me, not sure if we want this to target 2.1.5 but I don't have any problems with it

Copy link
Contributor

@ddanielr ddanielr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and confirmed that the get, set, and remove methods for JvmOptions all work.

@dlmarion dlmarion merged commit 4d016ba into apache:2.1 Dec 3, 2025
8 checks passed
@dlmarion dlmarion deleted the mutable-mac-jvm-opts branch December 3, 2025 20:39
Copy link
Member

@ctubbsii ctubbsii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR has already been merged, but I noticed a bug with the -D being added twice, and the mismatch on the setProperties API name with its behavior, so I felt this needed an after-the-fact review.

*/
public void setSystemProperties(Map<String,String> systemProperties) {
this.systemProperties = new HashMap<>(systemProperties);
this.systemProperties.putAll(systemProperties);
Copy link
Member

Choose a reason for hiding this comment

The 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.

Comment on lines +140 to +141
this.systemProperties.put("-Dapple.awt.UIElement", "true");
this.systemProperties.put("-Djava.net.preferIPv4Stack", "true");
Copy link
Member

Choose a reason for hiding this comment

The 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:

  1. Previously these were forced to appear after the user-specified properties, because we didn't want the user to override them, but now they can, and
  2. Previously, the -D was needed because they were being added separately from the system properties, but now, as part of the system properties, the -D is redundant, because the system properties set prepends the -D when constructing the command-line. So, these will get malformed as -D-D...

Comment on lines -355 to -362
// @formatter:off
var hardcodedArgs = Stream.of(
"-Dapple.awt.UIElement=true",
"-Djava.net.preferIPv4Stack=true",
"-XX:+PerfDisableSharedMem",
"-XX:+AlwaysPreTouch",
Main.class.getName(), clazz.getName());
// @formatter:on
Copy link
Member

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 -XX args should be override-able, but the -D ones here were intended to be not overrideable, because we didn't want the user to have to specify them each time they used setProperties(), because setProperties() was intended to replace, not append, to properties.

Comment on lines +715 to +723
/**
* Get the set of JVM options
*
* @return set of options
* @since 2.1.5
*/
public Set<String> getJvmOptions() {
return new HashSet<>(jvmOptions);
}
Copy link
Member

Choose a reason for hiding this comment

The 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.

dlmarion added a commit to dlmarion/accumulo that referenced this pull request Jan 15, 2026
@dlmarion
Copy link
Contributor Author

@ctubbsii - #6062 created to address these comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants