HDFS-4761. When resetting FSDirectory, the inodeMap should also be reset. Contributed by Jing Zhao

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1476452 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Tsz-wo Sze 2013-04-26 23:47:57 +00:00
parent d2495d553f
commit 75b4231a8c
3 changed files with 10 additions and 0 deletions

View File

@ -265,6 +265,9 @@ Trunk (Unreleased)
HDFS-4757. Update FSDirectory#inodeMap when replacing an INodeDirectory HDFS-4757. Update FSDirectory#inodeMap when replacing an INodeDirectory
while setting quota. (Jing Zhao via szetszwo) while setting quota. (Jing Zhao via szetszwo)
HDFS-4761. When resetting FSDirectory, the inodeMap should also be reset.
(Jing Zhao via szetszwo)
BREAKDOWN OF HADOOP-8562 SUBTASKS AND RELATED JIRAS BREAKDOWN OF HADOOP-8562 SUBTASKS AND RELATED JIRAS
HDFS-4145. Merge hdfs cmd line scripts from branch-1-win. (David Lao, HDFS-4145. Merge hdfs cmd line scripts from branch-1-win. (David Lao,

View File

@ -2022,6 +2022,8 @@ void reset() {
try { try {
setReady(false); setReady(false);
rootDir = createRoot(getFSNamesystem()); rootDir = createRoot(getFSNamesystem());
inodeMap.clear();
addToInodeMapUnprotected(rootDir);
nameCache.reset(); nameCache.reset();
} finally { } finally {
writeUnlock(); writeUnlock();

View File

@ -77,6 +77,7 @@
import org.apache.hadoop.util.StringUtils; import org.apache.hadoop.util.StringUtils;
import org.apache.log4j.Level; import org.apache.log4j.Level;
import org.junit.After; import org.junit.After;
import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.mockito.ArgumentMatcher; import org.mockito.ArgumentMatcher;
@ -1061,6 +1062,10 @@ public void testCheckpoint() throws IOException {
secondary = startSecondaryNameNode(conf); secondary = startSecondaryNameNode(conf);
secondary.doCheckpoint(); secondary.doCheckpoint();
FSDirectory secondaryFsDir = secondary.getFSNamesystem().dir;
INode rootInMap = secondaryFsDir.getInode(secondaryFsDir.rootDir.getId());
Assert.assertSame(rootInMap, secondaryFsDir.rootDir);
fileSys.delete(tmpDir, true); fileSys.delete(tmpDir, true);
fileSys.mkdirs(tmpDir); fileSys.mkdirs(tmpDir);
secondary.doCheckpoint(); secondary.doCheckpoint();