Skip to content

Commit ccf1504

Browse files
authored
Backport HBASE-26477 Fix MiniMapReduceCluster failure under Java17 to branch-2 (#3878)
Signed-off-by: Duo Zhang <[email protected]>
1 parent 2798ef1 commit ccf1504

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@
123123
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
124124
import org.apache.hadoop.hbase.util.FSTableDescriptors;
125125
import org.apache.hadoop.hbase.util.FSUtils;
126+
import org.apache.hadoop.hbase.util.JVM;
126127
import org.apache.hadoop.hbase.util.JVMClusterUtil;
127128
import org.apache.hadoop.hbase.util.JVMClusterUtil.MasterThread;
128129
import org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread;
@@ -2908,6 +2909,14 @@ private void startMiniMapReduceCluster(final int servers) throws IOException {
29082909
conf.setBoolean("mapreduce.reduce.speculative", false);
29092910
////
29102911

2912+
// Yarn container runs in independent JVM. We need to pass the argument manually here if the
2913+
// JDK version >= 17. Otherwise, the MiniMRCluster will fail.
2914+
if (JVM.getJVMSpecVersion() >= 17) {
2915+
String jvmOpts = conf.get("yarn.app.mapreduce.am.command-opts", "");
2916+
conf.set("yarn.app.mapreduce.am.command-opts",
2917+
jvmOpts + " --add-opens java.base/java.lang=ALL-UNNAMED");
2918+
}
2919+
29112920
// Allow the user to override FS URI for this map-reduce cluster to use.
29122921
mrCluster = new MiniMRCluster(servers,
29132922
FS_URI != null ? FS_URI : FileSystem.get(conf).getUri().toString(), 1,

0 commit comments

Comments
 (0)