[ 
https://issues.apache.org/jira/browse/HDFS-13101?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16899171#comment-16899171
 ] 

Tsz Wo Nicholas Sze commented on HDFS-13101:
--------------------------------------------

The fix could be
{code}
// DirectoryWithSnapshotFeature#cleanDirectory().
           if (priorCreated != null) {
-            // we only check the node originally in prior's created list
-            for (INode cNode : priorDiff.diff.getCreatedUnmodifiable()) {
-              if (priorCreated.containsKey(cNode)) {
-                cNode.cleanSubtree(reclaimContext, snapshot, NO_SNAPSHOT_ID);
+            if (currentINode.isLastReference()) {
+              // if this is the last reference, the created list can be 
destroyed.
+              priorDiff.getChildrenDiff().destroyCreatedList(
+                  reclaimContext, currentINode);
+            } else {
+              // we only check the node originally in prior's created list
+              for (INode cNode : priorDiff.diff.getCreatedUnmodifiable()) {
+                if (priorCreated.containsKey(cNode)) {
+                  cNode.cleanSubtree(reclaimContext, snapshot, NO_SNAPSHOT_ID);
+                }
               }
             }
           }
{code}
where isLastReference() is a new method in INode.
{code}
//INode.java
  /**
   * @return true if this is a reference and the reference count is 1;
   *         otherwise, return false.
   */
  public boolean isLastReference() {
    final INodeReference ref = getParentReference();
    if (!(ref instanceof WithCount)) {
      return false;
    }
    return ((WithCount)ref).getReferenceCount() == 1;
  }
{code}

> Yet another fsimage corruption related to snapshot
> --------------------------------------------------
>
>                 Key: HDFS-13101
>                 URL: https://issues.apache.org/jira/browse/HDFS-13101
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: snapshots
>            Reporter: Yongjun Zhang
>            Assignee: Shashikant Banerjee
>            Priority: Major
>         Attachments: HDFS-13101.001.patch, HDFS-13101.corruption_repro.patch, 
> HDFS-13101.corruption_repro_simplified.patch
>
>
> Lately we saw case similar to HDFS-9406, even though HDFS-9406 fix is 
> present, so it's likely another case not covered by the fix. We are currently 
> trying to collect good fsimage + editlogs to replay to reproduce it and 
> investigate. 



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to