[
https://issues.apache.org/jira/browse/HDFS-7761?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14317360#comment-14317360
]
Yi Liu commented on HDFS-7761:
------------------------------
Thanks [~arpitagarwal] for taking a look.
{quote}
I did take a look at your patch earlier today. The changes make the code
cleaner but one disadvantage is that we are always allocating the cached
arrays. I think it is better to allocate them on-demand.
{quote}
In the patch, we are *not* always allocating the cached arrays, and they are
allocated on-demand. We don't have *new* in the patch, could you give more
details, i.e. which code line shows we always allocating the cached arrays?
> cleanup unnecssary code logic in LocatedBlock
> ---------------------------------------------
>
> Key: HDFS-7761
> URL: https://issues.apache.org/jira/browse/HDFS-7761
> Project: Hadoop HDFS
> Issue Type: Improvement
> Affects Versions: 2.7.0
> Reporter: Yi Liu
> Assignee: Yi Liu
> Priority: Minor
> Attachments: HDFS-7761.001.patch, HDFS-7761.002.patch
>
>
> # The usage of following two variables is unnecessary. We can remove them to
> make code a bit brief.
> {quote}
> private final boolean hasStorageIDs;
> private final boolean hasStorageTypes;
> {quote}
> # In HDFS-7647, no need to modify {{LocatedBlock#getStorageTypes}} and
> {{LocatedBlock#getStorageIDs}}, we just need to update the cached
> {{storageIDs}} and {{storageTypes}} after *sort*.
> # Another thing is we'd better setSoftwareVersion when constructing
> {{DatanodeInfoWithStorage}} from {{DatanodeInfo}}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)