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
This commit is contained in:
Arpit Agarwal 2014-07-23 17:49:47 +00:00
parent c88402f36d
commit fa08b92f46
3 changed files with 14 additions and 5 deletions

View File

@ -805,6 +805,9 @@ Release 2.5.0 - UNRELEASED
HADOOP-10864. Tool documentenation is broken. (Akira Ajisaka HADOOP-10864. Tool documentenation is broken. (Akira Ajisaka
via Arpit Agarwal) 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 Release 2.4.1 - 2014-06-23
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -437,7 +437,9 @@ private FSDataOutputStream create(Path f, FsPermission permission,
throw new FileNotFoundException("Parent directory doesn't exist: " throw new FileNotFoundException("Parent directory doesn't exist: "
+ parent); + parent);
} else if (!mkdirs(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; final FSDataOutputStream out;

View File

@ -35,19 +35,22 @@
import org.junit.Test; import org.junit.Test;
public class TestPathData { public class TestPathData {
private static final String TEST_ROOT_DIR =
System.getProperty("test.build.data","build/test/data") + "/testPD";
protected Configuration conf; protected Configuration conf;
protected FileSystem fs; protected FileSystem fs;
protected Path testDir; protected Path testDir;
@Before @Before
public void initialize() throws Exception { public void initialize() throws Exception {
conf = new Configuration(); conf = new Configuration();
fs = FileSystem.getLocal(conf); fs = FileSystem.getLocal(conf);
testDir = new Path( testDir = new Path(TEST_ROOT_DIR);
System.getProperty("test.build.data", "build/test/data") + "/testPD"
);
// don't want scheme on the path, just an absolute path // don't want scheme on the path, just an absolute path
testDir = new Path(fs.makeQualified(testDir).toUri().getPath()); testDir = new Path(fs.makeQualified(testDir).toUri().getPath());
fs.mkdirs(testDir);
FileSystem.setDefaultUri(conf, fs.getUri()); FileSystem.setDefaultUri(conf, fs.getUri());
fs.setWorkingDirectory(testDir); fs.setWorkingDirectory(testDir);
fs.mkdirs(new Path("d1")); fs.mkdirs(new Path("d1"));
@ -60,6 +63,7 @@ public void initialize() throws Exception {
@After @After
public void cleanup() throws Exception { public void cleanup() throws Exception {
fs.delete(testDir, true);
fs.close(); fs.close();
} }