Skip to content

Commit 8caa11b

Browse files
committed
Revert "Fixed recursive foreverness. Added Test Case"
This reverts commit ffdd0de.
1 parent ffdd0de commit 8caa11b

File tree

2 files changed

+17
-45
lines changed

2 files changed

+17
-45
lines changed

src/main/java/org/apache/hadoop/fs/glusterfs/GlusterFileSystem.java

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public void initialize(URI uri, Configuration conf) throws IOException {
120120

121121
ret = FUSEMount(volName, remoteGFSServer, glusterMount);
122122
if (!ret) {
123-
//throw new RuntimeException("Initialize: Failed to mount GlusterFS ");
123+
throw new RuntimeException("Initialize: Failed to mount GlusterFS ");
124124
}
125125

126126
if((needQuickRead.length() != 0)
@@ -179,16 +179,21 @@ public boolean exists(Path path) throws IOException {
179179

180180
return f.exists();
181181
}
182-
public boolean mkdirs(Path f) throws IOException {
183-
184-
if(f==null) return true;
185-
186-
Path parent = f.getParent();
187-
Path absolute = makeAbsolute(f);
188-
File p2f = new File(absolute.toUri().getPath());
189-
return (f == null || mkdirs(parent)) && (p2f.mkdir() || p2f.isDirectory());
190-
}
191-
182+
183+
public boolean mkdirs(Path path, FsPermission permission)
184+
throws IOException {
185+
boolean created = false;
186+
Path absolute = makeAbsolute(path);
187+
File f = new File(absolute.toUri().getPath());
188+
189+
if (f.exists()) {
190+
System.out.println("Directory " + f.getPath() + " already exist");
191+
return true;
192+
}
193+
194+
return f.mkdirs();
195+
}
196+
192197
@Deprecated
193198
public boolean isDirectory(Path path) throws IOException {
194199
Path absolute = makeAbsolute(path);
@@ -509,10 +514,4 @@ public void completeLocalOutput(Path fsOutputFile, Path tmpLocalFile)
509514
throws IOException {
510515
moveFromLocalFile(tmpLocalFile, fsOutputFile);
511516
}
512-
513-
@Override
514-
public boolean mkdirs(Path arg0, FsPermission arg1) throws IOException {
515-
// TODO Auto-generated method stub
516-
return false;
517-
}
518517
}

src/test/java/org/gluster/test/TestGluster.java

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -249,34 +249,7 @@ public void testFiles() throws Exception {
249249
gfs.delete(file1);
250250
gfs.delete(file2);
251251
}
252-
253-
@org.junit.Test
254-
public void testTolerantMkdirs() throws Exception{
255-
System.out.println("Testing tollerance of mkdirs(a/b/c/d) then mkdirs(a/b/c)");
256-
Path longPath = new Path("a/b/c/d");
257-
258-
assertFalse(gfs.exists(longPath));
259-
gfs.mkdirs(longPath);
260-
assertTrue(gfs.exists(longPath));
261-
gfs.mkdirs(new Path("a"));
262-
assertTrue(gfs.exists(longPath));
263-
assertTrue(gfs.exists(new Path("a")));
264-
gfs.mkdirs(new Path("a/b"));
265-
assertTrue(gfs.exists(longPath));
266-
assertTrue(gfs.exists(new Path("a/b")));
267-
gfs.mkdirs(new Path("a/b/c"));
268-
assertTrue(gfs.exists(longPath));
269-
assertTrue(gfs.exists(new Path("a/b/c")));
270-
271-
/* delete the directories */
272-
273-
gfs.delete(longPath);
274-
assertFalse(gfs.exists(longPath));
275-
276-
277-
278-
}
279-
252+
280253
public void testFileIO() throws Exception {
281254

282255
Path subDir1 = new Path("tfio_dir.1");

0 commit comments

Comments
 (0)