HDFS-4726. Fix test failures after merging the INodeId-INode mapping from trunk. Contributed by Jing Zhao

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HDFS-2802@1470735 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Tsz-wo Sze 2013-04-22 22:13:58 +00:00
parent cb229db4bd
commit 43bdc22e92
6 changed files with 14 additions and 9 deletions

View File

@ -260,3 +260,6 @@ Branch-2802 Snapshot (Unreleased)
HdfsAdmin from String to Path. (szetszwo)
HDFS-4708. Add snapshot user documentation. (szetszwo)
HDFS-4726. Fix test failures after merging the INodeId-INode mapping
from trunk. (Jing Zhao via szetszwo)

View File

@ -474,10 +474,7 @@ public class INodeDirectory extends INodeWithAdditionalFields {
/** Set the children list to null. */
public void clearChildren() {
if (children != null) {
this.children.clear();
this.children = null;
}
this.children = null;
}
@Override
@ -514,6 +511,7 @@ public class INodeDirectory extends INodeWithAdditionalFields {
for (INode child : getChildrenList(null)) {
child.destroyAndCollectBlocks(collectedBlocks);
}
// TODO: Need to update the cleanSubtree/destroy methods to clean inode map
clear();
}

View File

@ -185,7 +185,7 @@ public class INodeDirectoryWithSnapshot extends INodeDirectoryWithQuota {
for (; c < created.size() && d < deleted.size(); ) {
INode cnode = created.get(c);
INode dnode = deleted.get(d);
if (cnode.equals(dnode)) {
if (cnode.compareTo(dnode.getLocalNameBytes()) == 0) {
fullPath[fullPath.length - 1] = cnode.getLocalNameBytes();
if (cnode.isSymlink() && dnode.isSymlink()) {
dList.add(new DiffReportEntry(DiffType.MODIFY, fullPath));

View File

@ -261,7 +261,7 @@ public class Diff<K, E extends Diff.Element<K>> {
public UndoInfo<E> modify(final E oldElement, final E newElement) {
Preconditions.checkArgument(oldElement != newElement,
"They are the same object: oldElement == newElement = %s", newElement);
Preconditions.checkArgument(oldElement.equals(newElement),
Preconditions.checkArgument(oldElement.compareTo(newElement.getKey()) == 0,
"The names do not match: oldElement=%s, newElement=%s",
oldElement, newElement);
final int c = search(created, newElement.getKey());

View File

@ -200,10 +200,14 @@ public class TestINodeFile {
// Check the full path name of the INode associating with the file
INode fnode = fsdir.getINode(file.toString());
assertEquals(file.toString(), fnode.getFullPathName());
// Call FSDirectory#unprotectedSetQuota which calls
// INodeDirectory#replaceChild
dfs.setQuota(dir, Long.MAX_VALUE - 1, replication * fileLen * 10);
INode dirNode = fsdir.getINode(dir.toString());
assertEquals(dir.toString(), dirNode.getFullPathName());
assertTrue(dirNode instanceof INodeDirectoryWithQuota);
final Path newDir = new Path("/newdir");
final Path newFile = new Path(newDir, "file");
// Also rename dir
@ -771,7 +775,7 @@ public class TestINodeFile {
PermissionStatus permstatus = PermissionStatus.createImmutable("", "", perm);
long id = 0;
INodeDirectory prev = new INodeDirectory(++id, null, permstatus, 0);
INodeDirectory prev = new INodeDirectory(++id, new byte[0], permstatus, 0);
INodeDirectory dir = null;
for (byte[] component : components) {
if (component.length == 0) {

View File

@ -192,7 +192,7 @@ public class TestRenameWithSnapshots {
* Rename a file under a snapshottable directory, file exists
* in a snapshot.
*/
@Test (timeout=60000)
@Test
public void testRenameFileInSnapshot() throws Exception {
hdfs.mkdirs(sub1);
hdfs.allowSnapshot(sub1);