HDFS-12832. INode.getFullPathName may throw ArrayIndexOutOfBoundsException lead to NameNode exit. Contribuited by Konstantin Shvachko.
This commit is contained in:
parent
30941d99c9
commit
d331762f24
|
@ -1825,8 +1825,6 @@ public class BlockManager implements BlockStatsMXBean {
|
||||||
}
|
}
|
||||||
|
|
||||||
// choose replication targets: NOT HOLDING THE GLOBAL LOCK
|
// choose replication targets: NOT HOLDING THE GLOBAL LOCK
|
||||||
// It is costly to extract the filename for which chooseTargets is called,
|
|
||||||
// so for now we pass in the block collection itself.
|
|
||||||
final BlockPlacementPolicy placementPolicy =
|
final BlockPlacementPolicy placementPolicy =
|
||||||
placementPolicies.getPolicy(rw.getBlock().getBlockType());
|
placementPolicies.getPolicy(rw.getBlock().getBlockType());
|
||||||
rw.chooseTargets(placementPolicy, storagePolicySuite, excludedNodes);
|
rw.chooseTargets(placementPolicy, storagePolicySuite, excludedNodes);
|
||||||
|
|
|
@ -32,7 +32,8 @@ import java.util.Set;
|
||||||
abstract class BlockReconstructionWork {
|
abstract class BlockReconstructionWork {
|
||||||
private final BlockInfo block;
|
private final BlockInfo block;
|
||||||
|
|
||||||
private final BlockCollection bc;
|
private final String srcPath;
|
||||||
|
private final byte storagePolicyID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An erasure coding reconstruction task has multiple source nodes.
|
* An erasure coding reconstruction task has multiple source nodes.
|
||||||
|
@ -57,7 +58,8 @@ abstract class BlockReconstructionWork {
|
||||||
int additionalReplRequired,
|
int additionalReplRequired,
|
||||||
int priority) {
|
int priority) {
|
||||||
this.block = block;
|
this.block = block;
|
||||||
this.bc = bc;
|
this.srcPath = bc.getName();
|
||||||
|
this.storagePolicyID = bc.getStoragePolicyID();
|
||||||
this.srcNodes = srcNodes;
|
this.srcNodes = srcNodes;
|
||||||
this.containingNodes = containingNodes;
|
this.containingNodes = containingNodes;
|
||||||
this.liveReplicaStorages = liveReplicaStorages;
|
this.liveReplicaStorages = liveReplicaStorages;
|
||||||
|
@ -94,8 +96,12 @@ abstract class BlockReconstructionWork {
|
||||||
return srcNodes;
|
return srcNodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockCollection getBc() {
|
public String getSrcPath() {
|
||||||
return bc;
|
return srcPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte getStoragePolicyID() {
|
||||||
|
return storagePolicyID;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<DatanodeStorageInfo> getLiveReplicaStorages() {
|
List<DatanodeStorageInfo> getLiveReplicaStorages() {
|
||||||
|
|
|
@ -58,10 +58,10 @@ class ErasureCodingWork extends BlockReconstructionWork {
|
||||||
Set<Node> excludedNodes) {
|
Set<Node> excludedNodes) {
|
||||||
// TODO: new placement policy for EC considering multiple writers
|
// TODO: new placement policy for EC considering multiple writers
|
||||||
DatanodeStorageInfo[] chosenTargets = blockplacement.chooseTarget(
|
DatanodeStorageInfo[] chosenTargets = blockplacement.chooseTarget(
|
||||||
getBc().getName(), getAdditionalReplRequired(), getSrcNodes()[0],
|
getSrcPath(), getAdditionalReplRequired(), getSrcNodes()[0],
|
||||||
getLiveReplicaStorages(), false, excludedNodes,
|
getLiveReplicaStorages(), false, excludedNodes,
|
||||||
getBlock().getNumBytes(),
|
getBlock().getNumBytes(),
|
||||||
storagePolicySuite.getPolicy(getBc().getStoragePolicyID()), null);
|
storagePolicySuite.getPolicy(getStoragePolicyID()), null);
|
||||||
setTargets(chosenTargets);
|
setTargets(chosenTargets);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,10 +44,10 @@ class ReplicationWork extends BlockReconstructionWork {
|
||||||
: "At least 1 source node should have been selected";
|
: "At least 1 source node should have been selected";
|
||||||
try {
|
try {
|
||||||
DatanodeStorageInfo[] chosenTargets = blockplacement.chooseTarget(
|
DatanodeStorageInfo[] chosenTargets = blockplacement.chooseTarget(
|
||||||
getBc().getName(), getAdditionalReplRequired(), getSrcNodes()[0],
|
getSrcPath(), getAdditionalReplRequired(), getSrcNodes()[0],
|
||||||
getLiveReplicaStorages(), false, excludedNodes,
|
getLiveReplicaStorages(), false, excludedNodes,
|
||||||
getBlock().getNumBytes(),
|
getBlock().getNumBytes(),
|
||||||
storagePolicySuite.getPolicy(getBc().getStoragePolicyID()),
|
storagePolicySuite.getPolicy(getStoragePolicyID()),
|
||||||
null);
|
null);
|
||||||
setTargets(chosenTargets);
|
setTargets(chosenTargets);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
Loading…
Reference in New Issue