hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Mollitor (Jira)" <j...@apache.org>
Subject [jira] [Updated] (HDFS-14864) DatanodeDescriptor Use Concurrent BlockingQueue
Date Fri, 20 Sep 2019 17:10:00 GMT

     [ https://issues.apache.org/jira/browse/HDFS-14864?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

David Mollitor updated HDFS-14864:
    Status: Patch Available  (was: Open)

> DatanodeDescriptor Use Concurrent BlockingQueue
> -----------------------------------------------
>                 Key: HDFS-14864
>                 URL: https://issues.apache.org/jira/browse/HDFS-14864
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: namenode
>    Affects Versions: 3.2.0
>            Reporter: David Mollitor
>            Assignee: David Mollitor
>            Priority: Minor
>         Attachments: HDFS-14864.1.patch
> https://github.com/apache/hadoop/blob/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/DatanodeDescriptor.java#L104-L106
> This collection needs to be thread safe and it needs to repeatedly poll the queue to
drain it, so use {{BlockingQueue}} which has a {{drain()}} method just for this purpose:
> {quote}
> This operation may be more efficient than repeatedly polling this queue.
> {quote}
> [https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/BlockingQueue.html#drainTo(java.util.Collection,%20int)]
> Also, the collection returns 'null' if there is nothing to drain from the queue.  This
is a confusing and error-prone affect.  It should just return an empty list.  I've also updated
the code to be more consistent and to return a java {{List}} in all places instead of a {{List}}
in some and a native array in others.  This will make the entire usage much more consistent
and safe.

This message was sent by Atlassian Jira

To unsubscribe, e-mail: hdfs-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-help@hadoop.apache.org

View raw message