liaoyuxiangqin created HDFS-13829:
-------------------------------------
Summary: Needn't get min value of scan index and length for
blockpoolReport
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
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: [email protected]
For additional commands, e-mail: [email protected]