Javadoc
Randomly choose one node from scope with the given storage type.
If scope starts with ~, choose one from the all nodes except for the
ones in scope; otherwise, choose one from scope.
If excludedNodes is given, choose a node that's not in excludedNodes.
This call would make up to two calls. It first tries to get a random node
(with old method) and check if it satisfies. If yes, simply return it.
Otherwise, it make a second call (with the new method) by passing in a
storage type.
This is for better performance reason. Put in short, the key note is that
the old method is faster but may take several runs, while the new method
is somewhat slower, and always succeed in one trial.
See HDFS-11535 for more detail.