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

Yongjun Zhang commented on HDFS-9231:
-------------------------------------

Hi [~xiaochen],

Thanks for reporting the issue and the patch. Good to have discussed in person. 
The patch looks good in general.  I have some comments here:

1. The description is not quite accurate per our discussion, suggest to modify. 
Especially the patch actually does change (and fix) the behavior when without 
-includeSnapshots.
2. A possible optimization in FSDirSnapshotOp#getSnapshotFiles. It seems that 
the {{sf}} variable could be calculated in caller for once before the loop in 
the caller, and pass to this method.
3. {{final INodesInPath iip = fsd.getINodesInPath4Write(snap, false);}} maybe 
substituted with call to {{getINodesInPath}}
4. The check {{if (!corruptFileBlocks.isEmpty())}} in 
{{listCorruptFileBlocksWithSnapshot}} is not needed
5. Add comment in {{listCorruptFileBlocks()}} before the call 
{{namenode.getNamesystem().listCorruptFileBlocksWithSnapshot}}, to indicate 
that {{snapshottableDirs}} is only relevant when  -includeSnapshots is 
specified.
6. In {{listCorruptFileBlocksWithSnapshot}}, we can add 
{code}
if (snapshottableDirs == null) {
  continue;
}
{code}
to avoid the call to {{getSnapshotFiles}}.

Thanks.



> fsck doesn't explicitly list when Bad Replicas/Blocks are in a snapshot
> -----------------------------------------------------------------------
>
>                 Key: HDFS-9231
>                 URL: https://issues.apache.org/jira/browse/HDFS-9231
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: snapshots
>            Reporter: Xiao Chen
>            Assignee: Xiao Chen
>         Attachments: HDFS-9231.001.patch, HDFS-9231.002.patch, 
> HDFS-9231.003.patch, HDFS-9231.004.patch
>
>
> For snapshot files, fsck shows corrupt blocks with the original file dir 
> instead of the snapshot dir.
> This can be confusing since even when the original file is deleted, a new 
> fsck run will still show that file as corrupted although what's actually 
> corrupted is the snapshot. 
> This is true even when given the -includeSnapshots option.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to