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

ASF GitHub Bot commented on HDFS-17045:
---------------------------------------

szetszwo opened a new pull request, #5738:
URL: https://github.com/apache/hadoop/pull/5738

   ### Description of PR
   
   Change the `shouldDestroy` method to returning `void`.  For the detail of 
this bug, see HDFS-17045.
   
   ### How was this patch tested?
   
   Added some checks on an existing test.
   
   ### For code changes:
   
   - [X] Does the title or this PR starts with the corresponding JIRA issue id 
(e.g. 'HADOOP-17799. Your PR title ...')?
   - [NA] Object storage: have the integration tests been executed and the 
endpoint declared according to the connector-specific documentation?
   - [NA] If adding new dependencies to the code, are these dependencies 
licensed in a way that is compatible for inclusion under [ASF 
2.0](http://www.apache.org/legal/resolved.html#category-a)?
   - [NA] If applicable, have you updated the `LICENSE`, `LICENSE-binary`, 
`NOTICE-binary` files?
   
   




> File renamed from a snapshottable dir to a non-snapshottable dir cannot be 
> deleted.
> -----------------------------------------------------------------------------------
>
>                 Key: HDFS-17045
>                 URL: https://issues.apache.org/jira/browse/HDFS-17045
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: namenode, snapshots
>            Reporter: Tsz-wo Sze
>            Assignee: Tsz-wo Sze
>            Priority: Major
>
> HDFS-16972 added a  
> [shouldDestroy|https://github.com/szetszwo/hadoop/blob/331e075115b4a35574622318b26f6d4731658d57/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/INodeReference.java#L834-L845]
>  method which caused the following bug.
> h3. Background:
>  - When {{FileSystem.rename(src, dst)}} happens, dstSnapshotId is set to the 
> latest snapshot at dst. As a result, dst is NOT in dstSnapshotId because 
> dstSnapshotId was already taken before rename.
>  - snapshotToBeDeleted is the snapshot id of the current operation if the 
> operation is {{FileSystem.deleteSnapshot}}. Otherwise, snapshotToBeDeleted is 
> set to CURRENT_STATE_ID.
>  - If (snapshotToBeDeleted > dstSnapshotId), dst is in snapshotToBeDeleted. 
> The shouldDestroy method returns true to continue deletion.
>  - If (snapshotToBeDeleted <= dstSnapshotId), dst must not be in 
> snapshotToBeDeleted. The shouldDestroy method returns false to stop deletion.
> h3. Bug
>  - If rename(src, dst) from a snapshottable dir (src) to a non-snapshottable 
> dir (dst), dstSnapshotId becomes CURRENT_STATE_ID.
>  - When {{FileSystem.delete(dst)}} happens, snapshotToBeDeleted is also set 
> to CURRENT_STATE_ID.
>  - In this case, snapshotToBeDeleted == dstSnapshotId, the shouldDestroy 
> method will return false and it incorrectly stops the deletion.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to