Skip to content

Commit

Permalink
Add UnlockExperimentalVMOptions to priority JVM options (#9476)
Browse files Browse the repository at this point in the history
Signed-off-by: Mikhail Kamornikau <[email protected]>
  • Loading branch information
mikekamornikov authored Dec 19, 2023
1 parent 391179f commit 2bffd4c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public final class JvmOptionUtils {
/**
* Set of JVM performance options to be prioritized in sorting.
*/
private static final Set<String> JVM_PERFORMANCE_PRIORITY_OPTIONS = Set.of("UnlockDiagnosticVMOptions");
private static final Set<String> JVM_PERFORMANCE_PRIORITY_OPTIONS = Set.of("UnlockDiagnosticVMOptions", "UnlockExperimentalVMOptions");

private static final String X_MS = "-Xms";
private static final String X_MX = "-Xmx";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,29 @@ void testThatUnlockDiagnosticVMOptionsPerformanceOptionIsAlwaysSetFirst() {
assertThat(envVars, equalTo(List.of(expectedPerformanceOpts)));
}

@ParallelTest
void testThatUnlockExperimentalVMOptionsPerformanceOptionIsAlwaysSetFirst() {
// when
var envVars = new ArrayList<EnvVar>();
var jvmOptions = new JvmOptions();
jvmOptions.setXx(Map.of(
"a", "1",
"b", "false",
"c", "true",
"UnlockExperimentalVMOptions", "true",
"z", "anything"));

// when
JvmOptionUtils.jvmPerformanceOptions(envVars, jvmOptions);

// then
var expectedPerformanceOpts = new EnvVarBuilder()
.withName(AbstractModel.ENV_VAR_KAFKA_JVM_PERFORMANCE_OPTS)
.withValue("-XX:+UnlockExperimentalVMOptions -XX:a=1 -XX:-b -XX:+c -XX:z=anything")
.build();
assertThat(envVars, equalTo(List.of(expectedPerformanceOpts)));
}

@ParallelTest
void testThatJavaOptionsAreIgnoredOnNullJvmOptions() {
// given
Expand Down

0 comments on commit 2bffd4c

Please sign in to comment.