Skip to content

Commit cccea6d

Browse files
committed
CDH-53913 Revert "HADOOP-14255. S3A to delete unnecessary fake directory objects in mkdirs(). Contributed by Mingliang Liu"
This reverts commit 37272e5. Change-Id: Ide3995c49b992e14df0b783bbc23f583eaf7c68f
1 parent 35e2403 commit cccea6d

File tree

2 files changed

+2
-43
lines changed

2 files changed

+2
-43
lines changed

hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/contract/AbstractContractMkdirTest.java

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -126,46 +126,4 @@ public void testMkdirSlashHandling() throws Throwable {
126126
assertPathExists("check path existence without trailing slash failed",
127127
path("testmkdir/b"));
128128
}
129-
130-
@Test
131-
public void testMkdirsPopulatingAllNonexistentAncestors() throws IOException {
132-
describe("Verify mkdir will populate all its non-existent ancestors");
133-
final FileSystem fs = getFileSystem();
134-
135-
final Path parent = path("testMkdirsPopulatingAllNonexistentAncestors");
136-
assertTrue(fs.mkdirs(parent));
137-
assertPathExists(parent + " should exist before making nested dir", parent);
138-
139-
Path nested = path(parent + "/a/b/c/d/e/f/g/h/i/j/k/L");
140-
assertTrue(fs.mkdirs(nested));
141-
while (nested != null && !nested.equals(parent) && !nested.isRoot()) {
142-
assertPathExists(nested + " nested dir should exist", nested);
143-
nested = nested.getParent();
144-
}
145-
}
146-
147-
@Test
148-
public void testMkdirsDoesNotRemoveParentDirectories() throws IOException {
149-
describe("Verify mkdir will make its parent existent");
150-
final FileSystem fs = getFileSystem();
151-
152-
final Path parent = path("testMkdirsDoesNotRemoveParentDirectories");
153-
assertTrue(fs.mkdirs(parent));
154-
155-
Path p = parent;
156-
for (int i = 0; i < 10; i++) {
157-
assertTrue(fs.mkdirs(p));
158-
assertPathExists(p + " should exist after mkdir(" + p + ")", p);
159-
p = path(p + "/dir-" + i);
160-
}
161-
162-
// After mkdirs(sub-directory), its parent directory still exists
163-
p = p.getParent();
164-
while (p != null && !p.equals(parent) && !p.isRoot()) {
165-
assertPathExists("Path " + p + " should exist", p);
166-
assertIsDirectory(p);
167-
p = p.getParent();
168-
}
169-
}
170-
171129
}

hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3AFileSystem.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1649,6 +1649,8 @@ public boolean mkdirs(Path path, FsPermission permission) throws IOException,
16491649
* @throws IOException other IO problems
16501650
* @throws AmazonClientException on failures inside the AWS SDK
16511651
*/
1652+
// TODO: If we have created an empty file at /foo/bar and we then call
1653+
// mkdirs for /foo/bar/baz/roo what happens to the empty file /foo/bar/?
16521654
private boolean innerMkdirs(Path p, FsPermission permission)
16531655
throws IOException, FileAlreadyExistsException, AmazonClientException {
16541656
Path f = qualify(p);
@@ -1699,7 +1701,6 @@ private boolean innerMkdirs(Path p, FsPermission permission)
16991701
String key = pathToKey(f);
17001702
createFakeDirectory(key);
17011703
S3Guard.makeDirsOrdered(metadataStore, metadataStoreDirs, username);
1702-
deleteUnnecessaryFakeDirectories(f.getParent());
17031704
return true;
17041705
}
17051706
}

0 commit comments

Comments
 (0)