[
https://issues.apache.org/jira/browse/HDFS-9484?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Mingliang Liu updated HDFS-9484:
--------------------------------
Attachment: HDFS-9484.001.patch
Thanks for the comment, [~shv].
I totally agree with you that the code snippet above is better as the code
change is small and simple. The v1 patch is to address this.
It's worth to note that the {{Arrays.asList}} returns a
{{java.util.Arrays.ArrayList}} object, which implements the {{List}} interface.
The v1 patch changes the {{blocks}} type from {{ArrayList}} to {{List}}. Given
that we don't add/delete items to/from this list, I think the {{List}}
interface works just as fine as {{ArrayList}}.
> 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, HDFS-9484.001.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)