HDFS-5474. Merge change r1541685 from trunk.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1541709 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jing Zhao 2013-11-13 21:00:52 +00:00
parent bdab9d5cfd
commit 8d673df9cb
2 changed files with 8 additions and 4 deletions

View File

@ -166,6 +166,9 @@ Release 2.3.0 - UNRELEASED
HDFS-5425. Renaming underconstruction file with snapshots can make NN failure on HDFS-5425. Renaming underconstruction file with snapshots can make NN failure on
restart. (jing9 and Vinay) restart. (jing9 and Vinay)
HDFS-5474. Deletesnapshot can make Namenode in safemode on NN restarts.
(Sathish via jing9)
HDFS-5075. httpfs-config.sh calls out incorrect env script name HDFS-5075. httpfs-config.sh calls out incorrect env script name
(Timothy St. Clair via stevel) (Timothy St. Clair via stevel)

View File

@ -6919,6 +6919,7 @@ public class FSNamesystem implements Namesystem, FSClusterStats,
return; // Return previous response return; // Return previous response
} }
boolean success = false; boolean success = false;
BlocksMapUpdateInfo collectedBlocks = new BlocksMapUpdateInfo();
writeLock(); writeLock();
try { try {
checkOperation(OperationCategory.WRITE); checkOperation(OperationCategory.WRITE);
@ -6927,7 +6928,6 @@ public class FSNamesystem implements Namesystem, FSClusterStats,
checkOwner(pc, snapshotRoot); checkOwner(pc, snapshotRoot);
} }
BlocksMapUpdateInfo collectedBlocks = new BlocksMapUpdateInfo();
List<INode> removedINodes = new ChunkedArrayList<INode>(); List<INode> removedINodes = new ChunkedArrayList<INode>();
dir.writeLock(); dir.writeLock();
try { try {
@ -6938,8 +6938,6 @@ public class FSNamesystem implements Namesystem, FSClusterStats,
dir.writeUnlock(); dir.writeUnlock();
} }
removedINodes.clear(); removedINodes.clear();
this.removeBlocks(collectedBlocks);
collectedBlocks.clear();
getEditLog().logDeleteSnapshot(snapshotRoot, snapshotName, getEditLog().logDeleteSnapshot(snapshotRoot, snapshotName,
cacheEntry != null); cacheEntry != null);
success = true; success = true;
@ -6949,6 +6947,9 @@ public class FSNamesystem implements Namesystem, FSClusterStats,
} }
getEditLog().logSync(); getEditLog().logSync();
removeBlocks(collectedBlocks);
collectedBlocks.clear();
if (auditLog.isInfoEnabled() && isExternalInvocation()) { if (auditLog.isInfoEnabled() && isExternalInvocation()) {
String rootPath = Snapshot.getSnapshotPath(snapshotRoot, snapshotName); String rootPath = Snapshot.getSnapshotPath(snapshotRoot, snapshotName);
logAuditEvent(true, "deleteSnapshot", rootPath, null, null); logAuditEvent(true, "deleteSnapshot", rootPath, null, null);