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 @@ int computeReconstructionWorkForBlocks(
|
||||
}
|
||||
|
||||
// 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 =
|
||||
placementPolicies.getPolicy(rw.getBlock().getBlockType());
|
||||
rw.chooseTargets(placementPolicy, storagePolicySuite, excludedNodes);
|
||||
|
@ -32,7 +32,8 @@
|
||||
abstract class BlockReconstructionWork {
|
||||
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.
|
||||
@ -57,7 +58,8 @@ public BlockReconstructionWork(BlockInfo block,
|
||||
int additionalReplRequired,
|
||||
int priority) {
|
||||
this.block = block;
|
||||
this.bc = bc;
|
||||
this.srcPath = bc.getName();
|
||||
this.storagePolicyID = bc.getStoragePolicyID();
|
||||
this.srcNodes = srcNodes;
|
||||
this.containingNodes = containingNodes;
|
||||
this.liveReplicaStorages = liveReplicaStorages;
|
||||
@ -94,8 +96,12 @@ public DatanodeDescriptor[] getSrcNodes() {
|
||||
return srcNodes;
|
||||
}
|
||||
|
||||
BlockCollection getBc() {
|
||||
return bc;
|
||||
public String getSrcPath() {
|
||||
return srcPath;
|
||||
}
|
||||
|
||||
public byte getStoragePolicyID() {
|
||||
return storagePolicyID;
|
||||
}
|
||||
|
||||
List<DatanodeStorageInfo> getLiveReplicaStorages() {
|
||||
|
@ -58,10 +58,10 @@ void chooseTargets(BlockPlacementPolicy blockplacement,
|
||||
Set<Node> excludedNodes) {
|
||||
// TODO: new placement policy for EC considering multiple writers
|
||||
DatanodeStorageInfo[] chosenTargets = blockplacement.chooseTarget(
|
||||
getBc().getName(), getAdditionalReplRequired(), getSrcNodes()[0],
|
||||
getSrcPath(), getAdditionalReplRequired(), getSrcNodes()[0],
|
||||
getLiveReplicaStorages(), false, excludedNodes,
|
||||
getBlock().getNumBytes(),
|
||||
storagePolicySuite.getPolicy(getBc().getStoragePolicyID()), null);
|
||||
storagePolicySuite.getPolicy(getStoragePolicyID()), null);
|
||||
setTargets(chosenTargets);
|
||||
}
|
||||
|
||||
|
@ -44,10 +44,10 @@ assert getSrcNodes().length > 0
|
||||
: "At least 1 source node should have been selected";
|
||||
try {
|
||||
DatanodeStorageInfo[] chosenTargets = blockplacement.chooseTarget(
|
||||
getBc().getName(), getAdditionalReplRequired(), getSrcNodes()[0],
|
||||
getSrcPath(), getAdditionalReplRequired(), getSrcNodes()[0],
|
||||
getLiveReplicaStorages(), false, excludedNodes,
|
||||
getBlock().getNumBytes(),
|
||||
storagePolicySuite.getPolicy(getBc().getStoragePolicyID()),
|
||||
storagePolicySuite.getPolicy(getStoragePolicyID()),
|
||||
null);
|
||||
setTargets(chosenTargets);
|
||||
} finally {
|
||||
|
Loading…
Reference in New Issue
Block a user