Skip to content

Commit 257d01a

Browse files
kiszksrowen
authored andcommitted
[SPARK-27397][CORE] Take care of OpenJ9 JVM in Spark
## What changes were proposed in this pull request? This PR supports `OpenJ9` in addition to `IBM JDK` and `OpenJDK` in Spark by handling `System.getProperty("java.vendor") = "Eclipse OpenJ9"`. In `inferDefaultMemory()` and `getKrb5LoginModuleName()`, this PR uses non `IBM` way. ``` $ ~/jdk-11.0.2+9_openj9-0.12.1/bin/jshell | Welcome to JShell -- Version 11.0.2 | For an introduction type: /help intro jshell> System.out.println(System.getProperty("java.vendor")) Eclipse OpenJ9 jshell> System.out.println(System.getProperty("java.vm.info")) JRE 11 Linux amd64-64-Bit Compressed References 20190204_127 (JIT enabled, AOT enabled) OpenJ9 - 90dd8cb40 OMR - d2f4534b JCL - 289c70b6844 based on jdk-11.0.2+9 jshell> System.out.println(Class.forName("com.ibm.lang.management.OperatingSystemMXBean").getDeclaredMethod("getTotalPhysicalMemory")) public abstract long com.ibm.lang.management.OperatingSystemMXBean.getTotalPhysicalMemory() jshell> System.out.println(Class.forName("com.sun.management.OperatingSystemMXBean").getDeclaredMethod("getTotalPhysicalMemorySize")) public abstract long com.sun.management.OperatingSystemMXBean.getTotalPhysicalMemorySize() jshell> System.out.println(Class.forName("com.ibm.security.auth.module.Krb5LoginModule")) | Exception java.lang.ClassNotFoundException: com.ibm.security.auth.module.Krb5LoginModule | at Class.forNameImpl (Native Method) | at Class.forName (Class.java:339) | at (#1:1) jshell> System.out.println(Class.forName("com.sun.security.auth.module.Krb5LoginModule")) class com.sun.security.auth.module.Krb5LoginModule ``` ## How was this patch tested? Existing test suites Manual testing with OpenJ9. Closes apache#24308 from kiszk/SPARK-27397. Authored-by: Kazuaki Ishizaki <[email protected]> Signed-off-by: Sean Owen <[email protected]>
1 parent 8718367 commit 257d01a

File tree

2 files changed

+3
-22
lines changed

2 files changed

+3
-22
lines changed

core/src/main/scala/org/apache/spark/util/SizeEstimator.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,9 @@ object SizeEstimator extends Logging {
131131
return System.getProperty(TEST_USE_COMPRESSED_OOPS_KEY).toBoolean
132132
}
133133

134-
// java.vm.info provides compressed ref info for IBM JDKs
135-
if (System.getProperty("java.vendor").contains("IBM")) {
134+
// java.vm.info provides compressed ref info for IBM and OpenJ9 JDKs
135+
val javaVendor = System.getProperty("java.vendor")
136+
if (javaVendor.contains("IBM") || javaVendor.contains("OpenJ9")) {
136137
return System.getProperty("java.vm.info").contains("Compressed Ref")
137138
}
138139

launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,6 @@ class CommandBuilderUtils {
3131
static final String DEFAULT_PROPERTIES_FILE = "spark-defaults.conf";
3232
static final String ENV_SPARK_HOME = "SPARK_HOME";
3333

34-
/** The set of known JVM vendors. */
35-
enum JavaVendor {
36-
Oracle, IBM, OpenJDK, Unknown
37-
}
38-
3934
/** Returns whether the given string is null or empty. */
4035
static boolean isEmpty(String s) {
4136
return s == null || s.isEmpty();
@@ -112,21 +107,6 @@ static boolean isWindows() {
112107
return os.startsWith("Windows");
113108
}
114109

115-
/** Returns an enum value indicating whose JVM is being used. */
116-
static JavaVendor getJavaVendor() {
117-
String vendorString = System.getProperty("java.vendor");
118-
if (vendorString.contains("Oracle")) {
119-
return JavaVendor.Oracle;
120-
}
121-
if (vendorString.contains("IBM")) {
122-
return JavaVendor.IBM;
123-
}
124-
if (vendorString.contains("OpenJDK")) {
125-
return JavaVendor.OpenJDK;
126-
}
127-
return JavaVendor.Unknown;
128-
}
129-
130110
/**
131111
* Updates the user environment, appending the given pathList to the existing value of the given
132112
* environment variable (or setting it if it hasn't yet been set).

0 commit comments

Comments
 (0)