svn merge -c 1487698 from trunk for HDFS-4863. The root directory should be added to the snapshottable directory list while loading fsimage.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1488096 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
74fa2f1de8
commit
6428612f35
|
@ -777,6 +777,9 @@ Release 2.0.5-beta - UNRELEASED
|
||||||
HDFS-4857. Snapshot.Root and AbstractINodeDiff#snapshotINode should not be
|
HDFS-4857. Snapshot.Root and AbstractINodeDiff#snapshotINode should not be
|
||||||
put into INodeMap when loading FSImage. (jing9)
|
put into INodeMap when loading FSImage. (jing9)
|
||||||
|
|
||||||
|
HDFS-4863. The root directory should be added to the snapshottable
|
||||||
|
directory list while loading fsimage. (jing9)
|
||||||
|
|
||||||
Release 2.0.4-alpha - 2013-04-25
|
Release 2.0.4-alpha - 2013-04-25
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -435,13 +435,16 @@ public class FSImageFormat {
|
||||||
if (numSnapshots >= 0) {
|
if (numSnapshots >= 0) {
|
||||||
final INodeDirectorySnapshottable snapshottableParent
|
final INodeDirectorySnapshottable snapshottableParent
|
||||||
= INodeDirectorySnapshottable.valueOf(parent, parent.getLocalName());
|
= INodeDirectorySnapshottable.valueOf(parent, parent.getLocalName());
|
||||||
if (snapshottableParent.getParent() != null) { // not root
|
|
||||||
this.namesystem.getSnapshotManager().addSnapshottable(
|
|
||||||
snapshottableParent);
|
|
||||||
}
|
|
||||||
// load snapshots and snapshotQuota
|
// load snapshots and snapshotQuota
|
||||||
SnapshotFSImageFormat.loadSnapshotList(snapshottableParent,
|
SnapshotFSImageFormat.loadSnapshotList(snapshottableParent,
|
||||||
numSnapshots, in, this);
|
numSnapshots, in, this);
|
||||||
|
if (snapshottableParent.getSnapshotQuota() > 0) {
|
||||||
|
// add the directory to the snapshottable directory list in
|
||||||
|
// SnapshotManager. Note that we only add root when its snapshot quota
|
||||||
|
// is positive.
|
||||||
|
this.namesystem.getSnapshotManager().addSnapshottable(
|
||||||
|
snapshottableParent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 3. Load children nodes under parent
|
// Step 3. Load children nodes under parent
|
||||||
|
|
|
@ -200,6 +200,23 @@ public class TestFSImageWithSnapshot {
|
||||||
List<DirectoryDiff> diffList = rootNode.getDiffs().asList();
|
List<DirectoryDiff> diffList = rootNode.getDiffs().asList();
|
||||||
assertEquals(1, diffList.size());
|
assertEquals(1, diffList.size());
|
||||||
assertEquals("s1", diffList.get(0).getSnapshot().getRoot().getLocalName());
|
assertEquals("s1", diffList.get(0).getSnapshot().getRoot().getLocalName());
|
||||||
|
|
||||||
|
// check SnapshotManager's snapshottable directory list
|
||||||
|
assertEquals(1, fsn.getSnapshotManager().getNumSnapshottableDirs());
|
||||||
|
SnapshottableDirectoryStatus[] sdirs = fsn.getSnapshotManager()
|
||||||
|
.getSnapshottableDirListing(null);
|
||||||
|
assertEquals(root, sdirs[0].getFullPath());
|
||||||
|
|
||||||
|
// save namespace and restart cluster
|
||||||
|
hdfs.setSafeMode(SafeModeAction.SAFEMODE_ENTER);
|
||||||
|
hdfs.saveNamespace();
|
||||||
|
hdfs.setSafeMode(SafeModeAction.SAFEMODE_LEAVE);
|
||||||
|
cluster.shutdown();
|
||||||
|
cluster = new MiniDFSCluster.Builder(conf).format(false)
|
||||||
|
.numDataNodes(REPLICATION).build();
|
||||||
|
cluster.waitActive();
|
||||||
|
fsn = cluster.getNamesystem();
|
||||||
|
hdfs = cluster.getFileSystem();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue