szetszwo commented on a change in pull request #2165:
URL: https://github.com/apache/hadoop/pull/2165#discussion_r463146771
##########
File path:
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
##########
@@ -7166,6 +7178,30 @@ void deleteSnapshot(String snapshotRoot, String
snapshotName,
logAuditEvent(true, operationName, rootPath, null, null);
}
+ public void gcDeletedSnapshot(String snapshotRoot, String snapshotName)
+ throws IOException {
+ final String operationName = "gcDeletedSnapshot";
+ String rootPath = null;
+ final INode.BlocksMapUpdateInfo blocksToBeDeleted;
+
+ checkOperation(OperationCategory.WRITE);
+ writeLock();
+ try {
+ checkOperation(OperationCategory.WRITE);
+ rootPath = Snapshot.getSnapshotPath(snapshotRoot, snapshotName);
+ checkNameNodeSafeMode("Cannot gcDeletedSnapshot for " + rootPath);
+
+ final long now = Time.now();
+ final INodesInPath iip = dir.resolvePath(null, snapshotRoot,
DirOp.WRITE);
+ snapshotManager.assertMarkedAsDeleted(iip, snapshotName);
+ blocksToBeDeleted = FSDirSnapshotOp.deleteSnapshot(
+ dir, snapshotManager, iip, snapshotName, now);
+ } finally {
+ writeUnlock(operationName, getLockReportInfoSupplier(rootPath));
+ }
+ removeBlocks(blocksToBeDeleted);
Review comment:
No. blocksToBeDeleted is never null.
The statement "if (blocksToBeDeleted != null)" in
FsNamesystem#deleteSnapshot actually generates a warning in IntelIJ saying that
"the condition blocksToBeDeleted != null is always true".
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]