Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -566,4 +566,10 @@ public static long getDAGSessionTimeout(Configuration conf) {
return 1000l * timeoutSecs;
}

public static int getJavaVersion() {
String javaVersionString = System.getProperty("java.version");
return javaVersionString.split("\\.")[0].equals("1")
? Integer.parseInt(javaVersionString.split("\\.")[1]) // "1.8" -> 8
: Integer.parseInt(javaVersionString.split("\\.")[0]); // "9.x" -> 9, "11.x" -> 11
}
}
21 changes: 19 additions & 2 deletions tez-api/src/main/java/org/apache/tez/dag/api/TezConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.util.Shell;
import org.apache.hadoop.yarn.api.records.LocalResource;
import org.apache.tez.common.TezCommonUtils;
import org.apache.tez.common.annotation.ConfigurationClass;
import org.apache.tez.common.annotation.ConfigurationProperty;
import org.apache.tez.dag.api.EdgeProperty.ConcurrentEdgeTriggerType;
Expand Down Expand Up @@ -343,8 +344,11 @@ public TezConfiguration(boolean loadDefaults) {
@ConfigurationScope(Scope.AM)
@ConfigurationProperty
public static final String TEZ_AM_LAUNCH_CMD_OPTS = TEZ_AM_PREFIX + "launch.cmd-opts";
public static final String TEZ_AM_LAUNCH_CMD_OPTS_DEFAULT =
public static final String TEZ_AM_LAUNCH_CMD_OPTS_JDK8_DEFAULT =
"-XX:+PrintGCDetails -verbose:gc -XX:+PrintGCTimeStamps -XX:+UseNUMA -XX:+UseParallelGC";
public static final String TEZ_AM_LAUNCH_CMD_OPTS_JDK9_DEFAULT =
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we create TEZ_AM_LAUNCH_CMD_OPTS_JDK8_DEFAULT with the origin value of TEZ_AM_LAUNCH_CMD_OPTS_DEFAULT.
Then we could statically assign TEZ_AM_LAUNCH_CMD_OPTS_DEFAULT to correct value of JDK8 or JDK9+. This would remove the runtime detection.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okay, I'm doing it in the next commit

"-verbose:gc -Xlog:gc*,safepoint::time,uptime -XX:+UseNUMA -XX:+UseParallelGC";
public static final String TEZ_AM_LAUNCH_CMD_OPTS_DEFAULT;

/**
* String value. Command line options which will be prepended to {@link
Expand All @@ -368,8 +372,21 @@ public TezConfiguration(boolean loadDefaults) {
@ConfigurationProperty
public static final String TEZ_TASK_LAUNCH_CMD_OPTS = TEZ_TASK_PREFIX
+ "launch.cmd-opts";
public static final String TEZ_TASK_LAUNCH_CMD_OPTS_DEFAULT =
public static final String TEZ_TASK_LAUNCH_CMD_OPTS_JDK8_DEFAULT =
"-XX:+PrintGCDetails -verbose:gc -XX:+PrintGCTimeStamps -XX:+UseNUMA -XX:+UseParallelGC";
public static final String TEZ_TASK_LAUNCH_CMD_OPTS_JDK9_DEFAULT =
"-verbose:gc -Xlog:gc*,safepoint::time,uptime -XX:+UseNUMA -XX:+UseParallelGC";
public static final String TEZ_TASK_LAUNCH_CMD_OPTS_DEFAULT;

static {
if (TezCommonUtils.getJavaVersion() >= 9) {
TEZ_AM_LAUNCH_CMD_OPTS_DEFAULT = TEZ_AM_LAUNCH_CMD_OPTS_JDK9_DEFAULT;
TEZ_TASK_LAUNCH_CMD_OPTS_DEFAULT = TEZ_TASK_LAUNCH_CMD_OPTS_JDK9_DEFAULT;
} else {
TEZ_AM_LAUNCH_CMD_OPTS_DEFAULT = TEZ_AM_LAUNCH_CMD_OPTS_JDK8_DEFAULT;
TEZ_TASK_LAUNCH_CMD_OPTS_DEFAULT = TEZ_TASK_LAUNCH_CMD_OPTS_JDK8_DEFAULT;
}
}

/**
* Double value. Tez automatically determines the Xmx for the JVMs used to run
Expand Down