[
https://issues.apache.org/jira/browse/HDFS-11577?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15942630#comment-15942630
]
Yiqun Lin edited comment on HDFS-11577 at 3/27/17 1:07 PM:
-----------------------------------------------------------
Thanks [~vagarychen] for the working. The patch almost LGTM.
Would you add some {{DEBUG}} level logs in the following places? It will be
good for us to test and debugging.
{code}
+ // next do a two-trial search
+ // first trial, call the old method, inherited from NetworkTopology
+ Node n = chooseRandom(searchScope, excludedScope, excludedNodes);
+ if (n == null) {
+ // this means there is simply no node to choose from
LOG.debug(....) <==== when no node to choose from
+ return null;
+ }
+ Preconditions.checkArgument(n instanceof DatanodeDescriptor);
+ DatanodeDescriptor dnDescriptor = (DatanodeDescriptor)n;
+
+ if (dnDescriptor.hasStorageType(type)) {
+ // the first trial succeeded, just return
+ return dnDescriptor;
+ } else {
+ // otherwise, make the second trial by calling the new method
LOG.debug(....) <==== when first trial failed
+ return chooseRandomWithStorageType(searchScope, excludedScope,
+ excludedNodes, type);
+ }
+ } finally {
+ netlock.readLock().unlock();
+ }
{code}
Once this is addressed, I will hold off the commit one day in case
[~arpitagarwal] or others has some further comments on this.
was (Author: linyiqun):
Thanks [~vagarychen] for the working. The patch LGTM. +1.
I will hold off the commit one day in case [~arpitagarwal] or others has some
further comments on this.
> Combine the old and the new chooseRandom for better performance
> ---------------------------------------------------------------
>
> Key: HDFS-11577
> URL: https://issues.apache.org/jira/browse/HDFS-11577
> Project: Hadoop HDFS
> Issue Type: Sub-task
> Components: namenode
> Reporter: Chen Liang
> Assignee: Chen Liang
> Attachments: HDFS-11577.001.patch
>
>
> As discussed in HDFS-11535, this JIRA adds a new function combining both the
> new and the old chooseRandom methods for better performance.
> More specifically, when choosing a random node with storage type requirement,
> the combined method first tries the old method of blindly picking a random
> node. If this node satisfies, it is returned. Otherwise, the new chooseRandom
> is called, which guarantees to find a eligible node in one call (if there is
> one at all).
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]