[
https://issues.apache.org/jira/browse/HDFS-14864?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16936252#comment-16936252
]
Íñigo Goiri commented on HDFS-14864:
------------------------------------
The failed unit tests don't seem related but do you mind checking?
> 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, HDFS-14864.2.patch,
> HDFS-14864.3.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
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]