[
https://issues.apache.org/jira/browse/HDFS-9484?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15037067#comment-15037067
]
Konstantin Shvachko commented on HDFS-9484:
-------------------------------------------
Yes indeed {{nrBlocks == blocks.size()}} always, because both are 0.
Wouldn't it be easier to change the constructor of TinyDatanode
{code}
- this.blocks = new ArrayList<BlockReportReplica>(blockCapacity);
+ this.blocks = Arrays.asList(new BlockReportReplica[blockCapacity]);
{code}
Then the set logic will work as intended.
The {{blockReportList}} part looks good.
> NNThroughputBenchmark$BlockReportStats should not send empty block reports
> --------------------------------------------------------------------------
>
> Key: HDFS-9484
> URL: https://issues.apache.org/jira/browse/HDFS-9484
> Project: Hadoop HDFS
> Issue Type: Bug
> Components: test
> Reporter: Mingliang Liu
> Assignee: Mingliang Liu
> Attachments: HDFS-9484.000.patch
>
>
> There are two potential bugs that make the
> {{NNThroughputBenchmark$BlockReportStats}} send empty block reports.
> # In {{NNThroughputBenchmark$BlockReportStats#formBlockReport()}}, the
> {{blockReportList}} is always {{BlockListAsLongs.EMPTY}}. We should construct
> the block report list by encoding generated {{blocks}} in test.
> # {{TinyDatanode#blocks}} is an empty ArrayList with initial capacity. In
> {{TinyDatanode#addBlock()}} first statement, the {{if(nrBlocks ==
> blocks.size()) {}} will always be true. We should either fill the blocks with
> dummy report in {{TinyDatanode()}} constructor, or use initial capacity
> instead of {{blocks.size()}} in the above _if_ statement (we should replace
> {{ArrayList#set}} with {{ArrayList#add}} as well).
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)