Consider the following scenario:
1. there are 4 slaves and topology like:
2. Reader from hostname1, and calculate weight between reader and [hostname1, hostname3, hostname4] by #getWeight, and their corresponding values are [0,4,4]
3. Reader from client which is not in the topology, and in the same IDC but in none rack of the topology, and calculate weight between reader and [hostname1, hostname3, hostname4] by #getWeightUsingNetworkLocation, and their corresponding values are [2,2,2]
4. Other different Reader can get the similar results.
The weight result for case #3 is obviously not the expected value, the truth is [4,4,4]. this issue may cause reader not really following arrange: local -> local rack -> remote rack.
After dig the detailed implement, the root cause is #getWeightUsingNetworkLocation only calculate distance between Racks rather than hosts.
I think we should add constant 2 to correct the weight of #getWeightUsingNetworkLocation.
- relates to
HDFS-16517 In 2.10 the distance metric is wrong for non-DN machines