Browse Source

MAPREDUCE-7468: Change add-opens flag's default value from true to false (#6442)

* MAPREDUCE-7468: Change add-opens flag's default value from true to false.

* MAPREDUCE-7468. [Addendum] Fix TestMapReduceChildJVM unit tests.

---------

Co-authored-by: Benjamin Teke <bteke@cloudera.com>
Benjamin Teke 1 năm trước cách đây
mục cha
commit
63de43768e

+ 3 - 3
hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TestMapReduceChildJVM.java

@@ -52,7 +52,6 @@ public class TestMapReduceChildJVM {
     MyMRApp app = new MyMRApp(1, 0, true, this.getClass().getName(), true);
     Configuration conf = new Configuration();
     conf.setBoolean(MRConfig.MAPREDUCE_APP_SUBMISSION_CROSS_PLATFORM, true);
-    conf.setBoolean(MRJobConfig.MAPREDUCE_JVM_ADD_OPENS_JAVA_OPT, false);
     Job job = app.submit(conf);
     app.waitForState(job, JobState.SUCCEEDED);
     app.verifyCompleted();
@@ -109,6 +108,7 @@ public class TestMapReduceChildJVM {
 
     MyMRApp app = new MyMRApp(0, 1, true, this.getClass().getName(), true);
     conf.setBoolean(MRConfig.MAPREDUCE_APP_SUBMISSION_CROSS_PLATFORM, true);
+    conf.setBoolean(MRJobConfig.MAPREDUCE_JVM_ADD_OPENS_JAVA_OPT, true);
     Job job = app.submit(conf);
     app.waitForState(job, JobState.SUCCEEDED);
     app.verifyCompleted();
@@ -150,7 +150,7 @@ public class TestMapReduceChildJVM {
   }
   
   @Test (timeout = 30000)
-  public void testCommandLineWithLog4JConifg() throws Exception {
+  public void testCommandLineWithLog4JConfig() throws Exception {
 
     MyMRApp app = new MyMRApp(1, 0, true, this.getClass().getName(), true);
     Configuration conf = new Configuration();
@@ -166,7 +166,7 @@ public class TestMapReduceChildJVM {
       "[" + MRApps.crossPlatformify("JAVA_HOME") + "/bin/java" +
       " -Djava.net.preferIPv4Stack=true" +
       " -Dhadoop.metrics.log.level=WARN " +
-      "  -Xmx820m <ADD_OPENS> -Djava.io.tmpdir=" + MRApps.crossPlatformify("PWD") + "/tmp" +
+      "  -Xmx820m -Djava.io.tmpdir=" + MRApps.crossPlatformify("PWD") + "/tmp" +
       " -Dlog4j.configuration=" + testLogPropertieFile +
       " -Dyarn.app.container.log.dir=<LOG_DIR>" +
       " -Dyarn.app.container.log.filesize=0" +

+ 1 - 1
hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/MRJobConfig.java

@@ -312,7 +312,7 @@ public interface MRJobConfig {
   public static final String MAPREDUCE_JVM_ADD_OPENS_JAVA_OPT =
     "mapreduce.jvm.add-opens-as-default";
 
-  public static final boolean MAPREDUCE_JVM_ADD_OPENS_JAVA_OPT_DEFAULT = true;
+  public static final boolean MAPREDUCE_JVM_ADD_OPENS_JAVA_OPT_DEFAULT = false;
 
   public static final String IO_SORT_FACTOR = "mapreduce.task.io.sort.factor";
 

+ 2 - 2
hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/resources/mapred-default.xml

@@ -1813,12 +1813,12 @@
 
 <property>
   <name>mapreduce.jvm.add-opens-as-default</name>
-  <value>true</value>
+  <value>false</value>
   <description>Since on JDK17 it's no longer possible to use the reflection API to
     access non-public fields and methods add-opens flags should be added to MR AM
     and map/reduce containers regardless of the user specified java opts. Setting
     this to true will add the flags to the container launch commands on nodes with
-    JDK17 or higher. Defaults to true, but the setting has no effect on nodes using
+    JDK17 or higher. Defaults to false, and the setting has no effect on nodes using
     JDK16 and before.
   </description>
 </property>