HDFS-4785. Merge change r1478267 from trunk

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1478286 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Suresh Srinivas 2013-05-02 06:48:36 +00:00
parent 78eaf8c3df
commit ab8ce0fcda
3 changed files with 24 additions and 1 deletions

View File

@ -224,6 +224,9 @@ Release 2.0.5-beta - UNRELEASED
HDFS-4748. MiniJournalCluster#restartJournalNode leaks resources, which HDFS-4748. MiniJournalCluster#restartJournalNode leaks resources, which
causes sporadic test failures. (Chris Nauroth via suresh) causes sporadic test failures. (Chris Nauroth via suresh)
HDFS-4785. Concat operation does not remove concatenated files from
InodeMap. (suresh)
Release 2.0.4-alpha - UNRELEASED Release 2.0.4-alpha - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -971,6 +971,7 @@ public void unprotectedConcat(String target, String [] srcs, long timestamp)
nodeToRemove.setBlocks(null); nodeToRemove.setBlocks(null);
trgParent.removeChild(nodeToRemove); trgParent.removeChild(nodeToRemove);
inodeMap.remove(nodeToRemove);
count++; count++;
} }

View File

@ -444,7 +444,26 @@ public void testInodeId() throws IOException {
inodeCount -= 2; inodeCount -= 2;
assertEquals(inodeCount, fsn.dir.getInodeMapSize()); assertEquals(inodeCount, fsn.dir.getInodeMapSize());
// Make sure empty editlog can be handled // Create and concat /test/file1 /test/file2
// Create /test1/file1 and /test1/file2
String file1 = "/test1/file1";
String file2 = "/test1/file2";
DFSTestUtil.createFile(fs, new Path(file1), 512, (short) 1, 0);
DFSTestUtil.createFile(fs, new Path(file2), 512, (short) 1, 0);
inodeCount += 3; // test1, file1 and file2 are created
expectedLastInodeId += 3;
assertEquals(inodeCount, fsn.dir.getInodeMapSize());
assertEquals(expectedLastInodeId, fsn.getLastInodeId());
// Concat the /test1/file1 /test1/file2 into /test1/file2
nnrpc.concat(file2, new String[] {file1});
inodeCount--; // file1 and file2 are concatenated to file2
assertEquals(inodeCount, fsn.dir.getInodeMapSize());
assertEquals(expectedLastInodeId, fsn.getLastInodeId());
assertTrue(fs.delete(new Path("/test1"), true));
inodeCount -= 2; // test1 and file2 is deleted
assertEquals(inodeCount, fsn.dir.getInodeMapSize());
// Make sure editlog is loaded correctly
cluster.restartNameNode(); cluster.restartNameNode();
cluster.waitActive(); cluster.waitActive();
fsn = cluster.getNamesystem(); fsn = cluster.getNamesystem();