HDFS-9474. TestPipelinesFailover should not fail when printing debug message. (John Zhuge via Yongjun Zhang)

(cherry picked from commit 59dbe8b3e9)
This commit is contained in:
Yongjun Zhang 2015-12-04 13:45:01 -08:00
parent 3beedc177d
commit 78a21e773d
2 changed files with 21 additions and 20 deletions

View File

@ -846,6 +846,9 @@ Release 2.8.0 - UNRELEASED
HDFS-9490. MiniDFSCluster should change block generation stamp via HDFS-9490. MiniDFSCluster should change block generation stamp via
FsDatasetTestUtils. (Tony Wu via lei) FsDatasetTestUtils. (Tony Wu via lei)
HDFS-9474. TestPipelinesFailover should not fail when printing debug
message. (John Zhuge via Yongjun Zhang)
OPTIMIZATIONS OPTIMIZATIONS
HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than

View File

@ -55,7 +55,7 @@ import org.apache.hadoop.test.GenericTestUtils;
import org.apache.hadoop.test.GenericTestUtils.DelayAnswer; import org.apache.hadoop.test.GenericTestUtils.DelayAnswer;
import org.apache.hadoop.test.MultithreadedTestUtil.RepeatingTestThread; import org.apache.hadoop.test.MultithreadedTestUtil.RepeatingTestThread;
import org.apache.hadoop.test.MultithreadedTestUtil.TestContext; import org.apache.hadoop.test.MultithreadedTestUtil.TestContext;
import org.apache.hadoop.util.Shell; import org.apache.hadoop.util.StringUtils;
import org.apache.hadoop.util.Shell.ShellCommandExecutor; import org.apache.hadoop.util.Shell.ShellCommandExecutor;
import org.apache.log4j.Level; import org.apache.log4j.Level;
import org.junit.Test; import org.junit.Test;
@ -420,28 +420,26 @@ public class TestPipelinesFailover {
// The following section of code is to help debug HDFS-6694 about // The following section of code is to help debug HDFS-6694 about
// this test that fails from time to time due to "too many open files". // this test that fails from time to time due to "too many open files".
// //
LOG.info("HDFS-6694 Debug Data BEGIN");
// Only collect debug data on these OSes. String[][] scmds = new String[][] {
if (Shell.LINUX || Shell.SOLARIS || Shell.MAC) { {"/bin/sh", "-c", "ulimit -a"},
System.out.println("HDFS-6694 Debug Data BEGIN==="); {"hostname"},
{"ifconfig", "-a"}
};
String[] scmd = new String[] {"/bin/sh", "-c", "ulimit -a"}; for (String[] scmd: scmds) {
String scmd_str = StringUtils.join(" ", scmd);
try {
ShellCommandExecutor sce = new ShellCommandExecutor(scmd); ShellCommandExecutor sce = new ShellCommandExecutor(scmd);
sce.execute(); sce.execute();
System.out.println("'ulimit -a' output:\n" + sce.getOutput()); LOG.info("'" + scmd_str + "' output:\n" + sce.getOutput());
} catch (IOException e) {
scmd = new String[] {"hostname"}; LOG.warn("Error when running '" + scmd_str + "'", e);
sce = new ShellCommandExecutor(scmd);
sce.execute();
System.out.println("'hostname' output:\n" + sce.getOutput());
scmd = new String[] {"ifconfig", "-a"};
sce = new ShellCommandExecutor(scmd);
sce.execute();
System.out.println("'ifconfig' output:\n" + sce.getOutput());
System.out.println("===HDFS-6694 Debug Data END");
} }
}
LOG.info("HDFS-6694 Debug Data END");
HAStressTestHarness harness = new HAStressTestHarness(); HAStressTestHarness harness = new HAStressTestHarness();
// Disable permissions so that another user can recover the lease. // Disable permissions so that another user can recover the lease.