You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-issues@hadoop.apache.org by "BELUGA BEHR (JIRA)" <ji...@apache.org> on 2019/02/18 21:59:00 UTC
[jira] [Updated] (HDFS-14296) Prefer ArrayList over LinkedList in
VolumeScanner
[ https://issues.apache.org/jira/browse/HDFS-14296?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
BELUGA BEHR updated HDFS-14296:
-------------------------------
Attachment: HDFS-14296.1.patch
> Prefer ArrayList over LinkedList in VolumeScanner
> -------------------------------------------------
>
> Key: HDFS-14296
> URL: https://issues.apache.org/jira/browse/HDFS-14296
> Project: Hadoop HDFS
> Issue Type: Improvement
> Components: datanode
> Affects Versions: 3.2.0
> Reporter: BELUGA BEHR
> Assignee: BELUGA BEHR
> Priority: Minor
> Attachments: HDFS-14296.1.patch
>
>
> {quote}The {{size}}, {{isEmpty}}, {{get}}, {{set}}, {{iterator}}, and {{listIterator}} operations run in constant time. - ArrayList
> {quote}
> However, for a {{LinkedList}}, the entire list must be traversed to get to the desired index.
> Like [Here|https://github.com/apache/hadoop/blob/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/VolumeScanner.java#L384]
> Most of the time, the List is being iterated, which is quicker over a primitive array than walking a LinkedList.
> There is one place where an item is removed, potentially from the middle of the list [here|https://github.com/apache/hadoop/blob/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/VolumeScanner.java#L736] but the speed of removing from the middle of the list isn't bad; it's a system native array shift, and it only happens on the off chance that a block pool is removed from the DataNode.
--
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