This is an automated email from the ASF dual-hosted git repository.
stoty pushed a commit to branch branch-2.5
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-2.5 by this push:
new 8ab9149a754 HBASE-29612 Remove HBaseTestingUtil.forceChangeTaskLogDir
(#7329)
8ab9149a754 is described below
commit 8ab9149a754fad7b4c5262ebbea296516bccb4a6
Author: Istvan Toth <[email protected]>
AuthorDate: Sat Sep 20 17:06:40 2025 +0200
HBASE-29612 Remove HBaseTestingUtil.forceChangeTaskLogDir (#7329)
Co-authored-by: Daniel Roudnitsky <[email protected]>
Signed-off-by: Duo Zhang <[email protected]>
(cherry picked from commit 99f8eabe19b4f9ef8e10ea0f0bea0a67d78436dc)
---
.../apache/hadoop/hbase/HBaseTestingUtility.java | 39 ++++------------------
1 file changed, 6 insertions(+), 33 deletions(-)
diff --git
a/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
index 3db73e1ad5f..bc49fe40638 100644
---
a/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
+++
b/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
@@ -28,7 +28,6 @@ import java.io.IOException;
import java.io.OutputStream;
import java.io.UncheckedIOException;
import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
import java.net.BindException;
import java.net.DatagramSocket;
import java.net.InetAddress;
@@ -139,7 +138,6 @@ import org.apache.hadoop.hbase.util.JVMClusterUtil;
import org.apache.hadoop.hbase.util.JVMClusterUtil.MasterThread;
import org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread;
import org.apache.hadoop.hbase.util.Pair;
-import org.apache.hadoop.hbase.util.ReflectionUtils;
import org.apache.hadoop.hbase.util.RegionSplitter;
import org.apache.hadoop.hbase.util.RegionSplitter.SplitAlgorithm;
import org.apache.hadoop.hbase.util.RetryCounter;
@@ -157,7 +155,6 @@ import
org.apache.hadoop.hdfs.server.datanode.fsdataset.FsDatasetSpi;
import org.apache.hadoop.hdfs.server.namenode.EditLogFileOutputStream;
import org.apache.hadoop.mapred.JobConf;
import org.apache.hadoop.mapred.MiniMRCluster;
-import org.apache.hadoop.mapred.TaskLog;
import org.apache.hadoop.minikdc.MiniKdc;
import org.apache.hadoop.security.authentication.util.KerberosName;
import org.apache.yetus.audience.InterfaceAudience;
@@ -2784,6 +2781,9 @@ public class HBaseTestingUtility extends
HBaseZKTestingUtility {
/**
* Starts a <code>MiniMRCluster</code> with a default number of
<code>TaskTracker</code>'s.
+ * MiniMRCluster caches hadoop.log.dir when first started. It is not
possible to start multiple
+ * MiniMRCluster instances with different log dirs. MiniMRCluster is only to
be used from when the
+ * test is run from a separate VM (i.e not in SmallTests)
* @throws IOException When starting the cluster fails.
*/
public MiniMRCluster startMiniMapReduceCluster() throws IOException {
@@ -2794,36 +2794,11 @@ public class HBaseTestingUtility extends
HBaseZKTestingUtility {
return mrCluster;
}
- /**
- * Tasktracker has a bug where changing the hadoop.log.dir system property
will not change its
- * internal static LOG_DIR variable.
- */
- private void forceChangeTaskLogDir() {
- Field logDirField;
- try {
- logDirField = TaskLog.class.getDeclaredField("LOG_DIR");
- logDirField.setAccessible(true);
-
- Field modifiersField = ReflectionUtils.getModifiersField();
- modifiersField.setAccessible(true);
- modifiersField.setInt(logDirField, logDirField.getModifiers() &
~Modifier.FINAL);
-
- logDirField.set(null, new File(hadoopLogDir, "userlogs"));
- } catch (SecurityException e) {
- throw new RuntimeException(e);
- } catch (NoSuchFieldException e) {
- // TODO Auto-generated catch block
- throw new RuntimeException(e);
- } catch (IllegalArgumentException e) {
- throw new RuntimeException(e);
- } catch (IllegalAccessException e) {
- throw new RuntimeException(e);
- }
- }
-
/**
* Starts a <code>MiniMRCluster</code>. Call {@link
#setFileSystemURI(String)} to use a different
- * filesystem.
+ * filesystem. MiniMRCluster caches hadoop.log.dir when first started. It is
not possible to start
+ * multiple MiniMRCluster instances with different log dirs. MiniMRCluster
is only to be used from
+ * when the test is run from a separate VM (i.e not in SmallTests)
* @param servers The number of <code>TaskTracker</code>'s to start.
* @throws IOException When starting the cluster fails.
*/
@@ -2835,8 +2810,6 @@ public class HBaseTestingUtility extends
HBaseZKTestingUtility {
setupClusterTestDir();
createDirsAndSetProperties();
- forceChangeTaskLogDir();
-
//// hadoop2 specific settings
// Tests were failing because this process used 6GB of virtual memory and
was getting killed.
// we up the VM usable so that processes don't get killed.