From fa08b92f46365980ac9405c544c69b8d4fafa0ef Mon Sep 17 00:00:00 2001 From: Arpit Agarwal Date: Wed, 23 Jul 2014 17:49:47 +0000 Subject: [PATCH] HADOOP-10872. TestPathData fails intermittently with 'Mkdirs failed to create d1'. (Contributed by Yongjun Zhang git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1612895 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-common-project/hadoop-common/CHANGES.txt | 3 +++ .../org/apache/hadoop/fs/ChecksumFileSystem.java | 4 +++- .../org/apache/hadoop/fs/shell/TestPathData.java | 12 ++++++++---- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 18758515b4..de28573920 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -805,6 +805,9 @@ Release 2.5.0 - UNRELEASED HADOOP-10864. Tool documentenation is broken. (Akira Ajisaka via Arpit Agarwal) + HADOOP-10872. TestPathData fails intermittently with "Mkdirs failed + to create d1". (Yongjun Zhang via Arpit Agarwal) + Release 2.4.1 - 2014-06-23 INCOMPATIBLE CHANGES diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/ChecksumFileSystem.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/ChecksumFileSystem.java index b67eadd94f..511ca7f754 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/ChecksumFileSystem.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/ChecksumFileSystem.java @@ -437,7 +437,9 @@ public abstract class ChecksumFileSystem extends FilterFileSystem { throw new FileNotFoundException("Parent directory doesn't exist: " + parent); } else if (!mkdirs(parent)) { - throw new IOException("Mkdirs failed to create " + parent); + throw new IOException("Mkdirs failed to create " + parent + + " (exists=" + exists(parent) + ", cwd=" + getWorkingDirectory() + + ")"); } } final FSDataOutputStream out; diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestPathData.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestPathData.java index 3ddd68da23..ea9e9847fd 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestPathData.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestPathData.java @@ -35,19 +35,22 @@ import org.junit.Before; import org.junit.Test; public class TestPathData { + private static final String TEST_ROOT_DIR = + System.getProperty("test.build.data","build/test/data") + "/testPD"; protected Configuration conf; protected FileSystem fs; protected Path testDir; - + @Before public void initialize() throws Exception { conf = new Configuration(); fs = FileSystem.getLocal(conf); - testDir = new Path( - System.getProperty("test.build.data", "build/test/data") + "/testPD" - ); + testDir = new Path(TEST_ROOT_DIR); + // don't want scheme on the path, just an absolute path testDir = new Path(fs.makeQualified(testDir).toUri().getPath()); + fs.mkdirs(testDir); + FileSystem.setDefaultUri(conf, fs.getUri()); fs.setWorkingDirectory(testDir); fs.mkdirs(new Path("d1")); @@ -60,6 +63,7 @@ public class TestPathData { @After public void cleanup() throws Exception { + fs.delete(testDir, true); fs.close(); }