bshashikant commented on a change in pull request #2163:
URL: https://github.com/apache/hadoop/pull/2163#discussion_r458571973
##########
File path:
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirSnapshotOp.java
##########
@@ -263,11 +269,18 @@ static SnapshotDiffReportListing
getSnapshotDiffReportListing(FSDirectory fsd,
final int earliest = snapshottable.getDiffs().iterator().next()
.getSnapshotId();
if (snapshot.getId() != earliest) {
- throw new SnapshotException("Failed to delete snapshot " + snapshotName
- + " from directory " + srcRoot.getFullPathName()
- + ": " + snapshot + " is not the earliest snapshot id=" + earliest
- + " (" + DFSConfigKeys.DFS_NAMENODE_SNAPSHOT_DELETION_ORDERED
- + " is " + fsd.isSnapshotDeletionOrdered() + ")");
+ final XAttr snapshotXAttr = buildXAttr(snapshotName);
+ final List<XAttr> xattrs = Lists.newArrayListWithCapacity(1);
+ xattrs.add(snapshotXAttr);
+
+ // The snapshot to be deleted is just marked for deletion in the xAttr.
+ // Same snaphot delete call can happen multiple times until annd unless
+ // the very 1st instance of a snapshot delete hides it/remove it from
+ // snapshot list. XAttrSetFlag.REPLACE needs to be set to here in order
+ // to address this.
+ FSDirXAttrOp.unprotectedSetXAttrs(fsd, iip, xattrs,
+ EnumSet.of(XAttrSetFlag.CREATE, XAttrSetFlag.REPLACE));
+ return null;
Review comment:
Addressed in the current patch.
----------------------------------------------------------------
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]