svn merge -c 1514156 from trunk for HDFS-4898. BlockPlacementPolicyWithNodeGroup.chooseRemoteRack() fails to properly fallback to local rack.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1514157 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
03420bbb4d
commit
49dcb7cfaa
|
@ -98,6 +98,9 @@ Release 2.1.1-beta - UNRELEASED
|
||||||
HDFS-5051. nn fails to download checkpointed image from snn in some
|
HDFS-5051. nn fails to download checkpointed image from snn in some
|
||||||
setups. (Vinay and suresh via suresh)
|
setups. (Vinay and suresh via suresh)
|
||||||
|
|
||||||
|
HDFS-4898. BlockPlacementPolicyWithNodeGroup.chooseRemoteRack() fails to
|
||||||
|
properly fallback to local rack. (szetszwo)
|
||||||
|
|
||||||
Release 2.1.0-beta - 2013-08-06
|
Release 2.1.0-beta - 2013-08-06
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -189,15 +189,18 @@ public class BlockPlacementPolicyWithNodeGroup extends BlockPlacementPolicyDefau
|
||||||
boolean avoidStaleNodes)
|
boolean avoidStaleNodes)
|
||||||
throws NotEnoughReplicasException {
|
throws NotEnoughReplicasException {
|
||||||
int oldNumOfReplicas = results.size();
|
int oldNumOfReplicas = results.size();
|
||||||
// randomly choose one node from remote racks
|
|
||||||
|
final String rackLocation = NetworkTopology.getFirstHalf(
|
||||||
|
localMachine.getNetworkLocation());
|
||||||
try {
|
try {
|
||||||
chooseRandom(numOfReplicas, "~"+NetworkTopology.getFirstHalf(
|
// randomly choose from remote racks
|
||||||
localMachine.getNetworkLocation()),
|
chooseRandom(numOfReplicas, "~" + rackLocation, excludedNodes, blocksize,
|
||||||
excludedNodes, blocksize, maxReplicasPerRack, results, avoidStaleNodes);
|
maxReplicasPerRack, results, avoidStaleNodes);
|
||||||
} catch (NotEnoughReplicasException e) {
|
} catch (NotEnoughReplicasException e) {
|
||||||
chooseRandom(numOfReplicas-(results.size()-oldNumOfReplicas),
|
// fall back to the local rack
|
||||||
localMachine.getNetworkLocation(), excludedNodes, blocksize,
|
chooseRandom(numOfReplicas - (results.size() - oldNumOfReplicas),
|
||||||
maxReplicasPerRack, results, avoidStaleNodes);
|
rackLocation, excludedNodes, blocksize,
|
||||||
|
maxReplicasPerRack, results, avoidStaleNodes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue