hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yiqun Lin (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (HDFS-13829) Remove redundant condition judgement in DirectoryScanner#scan
Date Thu, 16 Aug 2018 10:48:00 GMT

     [ https://issues.apache.org/jira/browse/HDFS-13829?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Yiqun Lin updated HDFS-13829:
-----------------------------
          Resolution: Fixed
        Hadoop Flags: Reviewed
       Fix Version/s: 3.2.0
    Target Version/s: 3.2.0
              Status: Resolved  (was: Patch Available)

Committed this to trunk, Thanks [~liaoyuxiangqin] for the contribution!

> Remove redundant condition judgement in DirectoryScanner#scan
> -------------------------------------------------------------
>
>                 Key: HDFS-13829
>                 URL: https://issues.apache.org/jira/browse/HDFS-13829
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: datanode
>    Affects Versions: 3.2.0
>         Environment: 
>            Reporter: liaoyuxiangqin
>            Assignee: liaoyuxiangqin
>            Priority: Major
>             Fix For: 3.2.0
>
>         Attachments: HDFS-13829.001.patch
>
>
> When i read the scan() of DirectoryScanner class in datanode, i found the following condition
code could be more simplify and easy to understand.
> DirectoryScanner.java
> {code:java}
> if (d < blockpoolReport.length) {
>             // There may be multiple on-disk records for the same block, don't increment
>             // the memory record pointer if so.
>             ScanInfo nextInfo = blockpoolReport[Math.min(d, blockpoolReport.length -
1)];
>             if (nextInfo.getBlockId() != info.getBlockId()) {
>               ++m;
>             }
> } else {
>             ++m;
>  }
> {code}
> as described above code segmet, i find the code of d < blockpoolReport.length and
the max of d is blockpoolReport.length-1, so that result of Math.min(d, blockpoolReport.length
- 1) always is d, so i think needn't to get min value of scan index and length for blockpoolReport.
> thanks!



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-help@hadoop.apache.org


Mime
View raw message