Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
09fcb3e
Pass sql/core releated cases
LuciferYang Sep 30, 2021
adc566d
SparkBuild.scala
LuciferYang Sep 30, 2021
70fc3bf
revert project/SparkBuild.scala
LuciferYang Sep 30, 2021
2b60264
add SparkBuild.sh
LuciferYang Sep 30, 2021
7e016b3
fix comments
LuciferYang Sep 30, 2021
44c566f
change SparkBuild
LuciferYang Sep 30, 2021
1761e74
fix utils
LuciferYang Sep 30, 2021
3b0f6ed
add commnets
LuciferYang Sep 30, 2021
0bb8df7
add commnets
LuciferYang Sep 30, 2021
0861c5d
add comments
LuciferYang Sep 30, 2021
86517e6
add comments
LuciferYang Sep 30, 2021
4981260
add commnet
LuciferYang Sep 30, 2021
32ac109
Merge branch 'upmaster' into SPARK-36796
LuciferYang Oct 11, 2021
4aa3643
resolve conflicts
LuciferYang Oct 11, 2021
cfe530f
revert
LuciferYang Oct 11, 2021
733a754
revert
LuciferYang Oct 11, 2021
f61215f
Merge branch 'upmaster' into SPARK-36796
LuciferYang Oct 11, 2021
e70e4cc
add IgnoreUnrecognizedVMOptions
LuciferYang Oct 11, 2021
8628ed6
refactor
LuciferYang Oct 11, 2021
4017630
revert
LuciferYang Oct 11, 2021
1abe44e
revert change of LauncherBackendSuite
LuciferYang Oct 11, 2021
2925783
refactor
LuciferYang Oct 11, 2021
0e4bba8
fix case
LuciferYang Oct 11, 2021
ad22526
remove unused mothod
LuciferYang Oct 11, 2021
1fb8fb1
remove JavaModuleUtils
LuciferYang Oct 11, 2021
fdd912e
change to use private
LuciferYang Oct 12, 2021
41e73fe
Merge branch 'upmaster' into SPARK-36796
LuciferYang Oct 12, 2021
67c041f
remove new conf
LuciferYang Oct 12, 2021
2e87bde
remove new conf
LuciferYang Oct 12, 2021
ee8b1b8
Merge branch 'upmaster' into SPARK-36796
LuciferYang Oct 13, 2021
bc4bad7
Merge branch 'upmaster' into SPARK-36796
LuciferYang Oct 13, 2021
40ab4a8
Merge branch 'upmaster' into SPARK-36796
LuciferYang Oct 14, 2021
5098d31
Merge branch 'upmaster' into SPARK-36796
LuciferYang Oct 18, 2021
e773fc4
remove HashSet
LuciferYang Oct 19, 2021
2dec62e
revert change of SQLQueryTestSuite
LuciferYang Oct 19, 2021
c7265c9
Merge branch 'upmaster' into SPARK-36796
LuciferYang Oct 19, 2021
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
19 changes: 19 additions & 0 deletions core/src/main/scala/org/apache/spark/SparkContext.scala
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import org.apache.spark.internal.config.Tests._
import org.apache.spark.internal.config.UI._
import org.apache.spark.internal.plugin.PluginContainer
import org.apache.spark.io.CompressionCodec
import org.apache.spark.launcher.JavaModuleOptions
import org.apache.spark.metrics.source.JVMCPUSource
import org.apache.spark.partial.{ApproximateEvaluator, PartialResult}
import org.apache.spark.rdd._
Expand Down Expand Up @@ -399,6 +400,8 @@ class SparkContext(config: SparkConf) extends Logging {
// This should be set as early as possible.
SparkContext.fillMissingMagicCommitterConfsIfNeeded(_conf)

SparkContext.supplementJavaModuleOptions(_conf)

_driverLogger = DriverLogger(_conf)

val resourcesFileOpt = conf.get(DRIVER_RESOURCES_FILE)
Expand Down Expand Up @@ -3025,6 +3028,22 @@ object SparkContext extends Logging {
}
}
}

/**
* SPARK-36796: This is a helper function to supplement `--add-opens` options to
* `spark.driver.extraJavaOptions` and `spark.executor.extraJavaOptions`.
*/
private def supplementJavaModuleOptions(conf: SparkConf): Unit = {
def supplement(key: OptionalConfigEntry[String]): Unit = {
val v = conf.get(key) match {
case Some(opts) => s"${JavaModuleOptions.defaultModuleOptions()} $opts"
case None => JavaModuleOptions.defaultModuleOptions()
}
conf.set(key.key, v)
}
supplement(DRIVER_JAVA_OPTIONS)
supplement(EXECUTOR_JAVA_OPTIONS)
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.spark.launcher;

/**
* This helper class is used to place the all `--add-opens` options
* required by Spark when using Java 17. `DEFAULT_MODULE_OPTIONS` has added
* `-XX:+IgnoreUnrecognizedVMOptions` to be compatible with Java 8 and Java 11.
*/
public class JavaModuleOptions {
private static final String[] DEFAULT_MODULE_OPTIONS = {
"-XX:+IgnoreUnrecognizedVMOptions",
"--add-opens=java.base/java.lang=ALL-UNNAMED",
"--add-opens=java.base/java.lang.invoke=ALL-UNNAMED",
"--add-opens=java.base/java.io=ALL-UNNAMED",
"--add-opens=java.base/java.net=ALL-UNNAMED",
"--add-opens=java.base/java.nio=ALL-UNNAMED",
"--add-opens=java.base/java.util=ALL-UNNAMED",
"--add-opens=java.base/java.util.concurrent=ALL-UNNAMED",
"--add-opens=java.base/sun.nio.ch=ALL-UNNAMED",
"--add-opens=java.base/sun.nio.cs=ALL-UNNAMED",
"--add-opens=java.base/sun.security.action=ALL-UNNAMED",
"--add-opens=java.base/sun.util.calendar=ALL-UNNAMED"};

/**
* Returns the default Java options related to `--add-opens' and
* `-XX:+IgnoreUnrecognizedVMOptions` used by Spark.
*/
public static String defaultModuleOptions() {
return String.join(" ", DEFAULT_MODULE_OPTIONS);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,8 @@ private List<String> buildSparkSubmitCommand(Map<String, String> env)
config.get(SparkLauncher.DRIVER_EXTRA_LIBRARY_PATH));
}

// SPARK-36796: Always add default `--add-opens` to submit command
addOptionString(cmd, JavaModuleOptions.defaultModuleOptions());
cmd.add("org.apache.spark.deploy.SparkSubmit");
cmd.addAll(buildSparkSubmitArgs());
return cmd;
Expand Down
20 changes: 18 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,22 @@
<CodeCacheSize>128m</CodeCacheSize>
<!-- Needed for consistent times -->
<maven.build.timestamp.format>yyyy-MM-dd HH:mm:ss z</maven.build.timestamp.format>

<!-- SPARK-36796 for JDK-17 test-->
<extraJavaTestArgs>
-XX:+IgnoreUnrecognizedVMOptions
--add-opens=java.base/java.lang=ALL-UNNAMED
--add-opens=java.base/java.lang.invoke=ALL-UNNAMED
--add-opens=java.base/java.io=ALL-UNNAMED
--add-opens=java.base/java.net=ALL-UNNAMED
--add-opens=java.base/java.nio=ALL-UNNAMED
--add-opens=java.base/java.util=ALL-UNNAMED
--add-opens=java.base/java.util.concurrent=ALL-UNNAMED
--add-opens=java.base/sun.nio.ch=ALL-UNNAMED
--add-opens=java.base/sun.nio.cs=ALL-UNNAMED
--add-opens=java.base/sun.security.action=ALL-UNNAMED
--add-opens=java.base/sun.util.calendar=ALL-UNNAMED
</extraJavaTestArgs>
</properties>
<repositories>
<repository>
Expand Down Expand Up @@ -2707,7 +2723,7 @@
<include>**/*Suite.java</include>
</includes>
<reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
<argLine>-ea -Xmx4g -Xss4m -XX:MaxMetaspaceSize=2g -XX:ReservedCodeCacheSize=${CodeCacheSize} -Dio.netty.tryReflectionSetAccessible=true</argLine>
<argLine>-ea -Xmx4g -Xss4m -XX:MaxMetaspaceSize=2g -XX:ReservedCodeCacheSize=${CodeCacheSize} ${extraJavaTestArgs} -Dio.netty.tryReflectionSetAccessible=true</argLine>
<environmentVariables>
<!--
Setting SPARK_DIST_CLASSPATH is a simple way to make sure any child processes
Expand Down Expand Up @@ -2758,7 +2774,7 @@
<reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
<junitxml>.</junitxml>
<filereports>SparkTestSuite.txt</filereports>
<argLine>-ea -Xmx4g -Xss4m -XX:MaxMetaspaceSize=2g -XX:ReservedCodeCacheSize=${CodeCacheSize} -Dio.netty.tryReflectionSetAccessible=true</argLine>
<argLine>-ea -Xmx4g -Xss4m -XX:MaxMetaspaceSize=2g -XX:ReservedCodeCacheSize=${CodeCacheSize} ${extraJavaTestArgs} -Dio.netty.tryReflectionSetAccessible=true</argLine>
<stderr/>
<environmentVariables>
<!--
Expand Down
14 changes: 13 additions & 1 deletion project/SparkBuild.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1127,7 +1127,19 @@ object TestSettings {
// SPARK-29282 This is for consistency between JDK8 and JDK11.
(Test / javaOptions) ++= {
val metaspaceSize = sys.env.get("METASPACE_SIZE").getOrElse("1300m")
s"-Xmx4g -Xss4m -XX:MaxMetaspaceSize=$metaspaceSize -XX:+UseParallelGC -XX:-UseDynamicNumberOfGCThreads -XX:ReservedCodeCacheSize=128m"
val extraTestJavaArgs = Array("-XX:+IgnoreUnrecognizedVMOptions",
"--add-opens=java.base/java.lang=ALL-UNNAMED",
"--add-opens=java.base/java.lang.invoke=ALL-UNNAMED",
"--add-opens=java.base/java.io=ALL-UNNAMED",
"--add-opens=java.base/java.net=ALL-UNNAMED",
"--add-opens=java.base/java.nio=ALL-UNNAMED",
"--add-opens=java.base/java.util=ALL-UNNAMED",
"--add-opens=java.base/java.util.concurrent=ALL-UNNAMED",
"--add-opens=java.base/sun.nio.ch=ALL-UNNAMED",
"--add-opens=java.base/sun.nio.cs=ALL-UNNAMED",
"--add-opens=java.base/sun.security.action=ALL-UNNAMED",
"--add-opens=java.base/sun.util.calendar=ALL-UNNAMED").mkString(" ")
s"-Xmx4g -Xss4m -XX:MaxMetaspaceSize=$metaspaceSize -XX:+UseParallelGC -XX:-UseDynamicNumberOfGCThreads -XX:ReservedCodeCacheSize=128m $extraTestJavaArgs"
.split(" ").toSeq
},
javaOptions ++= {
Expand Down
2 changes: 1 addition & 1 deletion sql/catalyst/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
<groupId>org.scalatest</groupId>
<artifactId>scalatest-maven-plugin</artifactId>
<configuration>
<argLine>-ea -Xmx4g -Xss4m -XX:ReservedCodeCacheSize=${CodeCacheSize} -Dio.netty.tryReflectionSetAccessible=true</argLine>
<argLine>-ea -Xmx4g -Xss4m -XX:ReservedCodeCacheSize=${CodeCacheSize} ${extraJavaTestArgs} -Dio.netty.tryReflectionSetAccessible=true</argLine>
</configuration>
</plugin>
<plugin>
Expand Down
2 changes: 1 addition & 1 deletion sql/core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@
<groupId>org.scalatest</groupId>
<artifactId>scalatest-maven-plugin</artifactId>
<configuration>
<argLine>-ea -Xmx4g -Xss4m -XX:ReservedCodeCacheSize=${CodeCacheSize} -Dio.netty.tryReflectionSetAccessible=true</argLine>
<argLine>-ea -Xmx4g -Xss4m -XX:ReservedCodeCacheSize=${CodeCacheSize} ${extraJavaTestArgs} -Dio.netty.tryReflectionSetAccessible=true</argLine>
</configuration>
</plugin>
<plugin>
Expand Down