[
https://issues.apache.org/jira/browse/HDFS-7831?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14334535#comment-14334535
]
Konstantin Shvachko commented on HDFS-7831:
-------------------------------------------
{{binarySearch(diffs, snapshotId)}} returns {{i == -insertPoint-1}}, where
{{insertPoint}} is the index of the first element greater than the key. So if
the {{snapshotId}} is not found then we can start searching backwards from
{{insertPoint-1 == -i-2}}.
So we are checking two extra elements.
> Fix the starting index of the loop in
> FileDiffList.findEarlierSnapshotBlocks().
> -------------------------------------------------------------------------------
>
> Key: HDFS-7831
> URL: https://issues.apache.org/jira/browse/HDFS-7831
> Project: Hadoop HDFS
> Issue Type: Bug
> Affects Versions: 2.7.0
> Reporter: Konstantin Shvachko
>
> Currently the loop in {{FileDiffList.findEarlierSnapshotBlocks()}} starts
> from {{insertPoint + 1}}. It should start from {{insertPoint - 1}}. As noted
> in [Jing's
> comment|https://issues.apache.org/jira/browse/HDFS-7056?focusedCommentId=14333864&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14333864]
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)