Skip to content

Commit 96d699a

Browse files
authored
HBASE-26477 Fix MiniMapReduceCluster failure under Java17 (#3867)
Signed-off-by: Wei-Chiu Chuang <[email protected]> Signed-off-by: Duo Zhang <[email protected]>
1 parent 1c48248 commit 96d699a

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/HBaseTestingUtil.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@
122122
import org.apache.hadoop.hbase.util.CommonFSUtils;
123123
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
124124
import org.apache.hadoop.hbase.util.FSUtils;
125+
import org.apache.hadoop.hbase.util.JVM;
125126
import org.apache.hadoop.hbase.util.JVMClusterUtil;
126127
import org.apache.hadoop.hbase.util.JVMClusterUtil.MasterThread;
127128
import org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread;
@@ -2322,6 +2323,14 @@ private void startMiniMapReduceCluster(final int servers) throws IOException {
23222323
conf.setBoolean("mapreduce.reduce.speculative", false);
23232324
////
23242325

2326+
// Yarn container runs in independent JVM. We need to pass the argument manually here if the
2327+
// JDK version >= 17. Otherwise, the MiniMRCluster will fail.
2328+
if (JVM.getJVMSpecVersion() >= 17) {
2329+
String jvmOpts = conf.get("yarn.app.mapreduce.am.command-opts", "");
2330+
conf.set("yarn.app.mapreduce.am.command-opts",
2331+
jvmOpts + " --add-opens java.base/java.lang=ALL-UNNAMED");
2332+
}
2333+
23252334
// Allow the user to override FS URI for this map-reduce cluster to use.
23262335
mrCluster =
23272336
new MiniMRCluster(servers, FS_URI != null ? FS_URI : FileSystem.get(conf).getUri().toString(),

0 commit comments

Comments
 (0)