HDFS-12832. INode.getFullPathName may throw ArrayIndexOutOfBoundsException lead to NameNode exit. Contribuited by Konstantin Shvachko.
(cherry picked from commitd331762f24
) (cherry picked from commit3219b1bdf6
)
This commit is contained in:
parent
f92fea391e
commit
a32ae95b09
|
@ -1527,8 +1527,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.
|
|
||||||
rw.chooseTargets(blockplacement, storagePolicySuite, excludedNodes);
|
rw.chooseTargets(blockplacement, storagePolicySuite, excludedNodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,8 @@ import java.util.Set;
|
||||||
|
|
||||||
class ReplicationWork {
|
class ReplicationWork {
|
||||||
private final BlockInfo block;
|
private final BlockInfo block;
|
||||||
private final BlockCollection bc;
|
private final String srcPath;
|
||||||
|
private final byte storagePolicyID;
|
||||||
private final DatanodeDescriptor srcNode;
|
private final DatanodeDescriptor srcNode;
|
||||||
private final int additionalReplRequired;
|
private final int additionalReplRequired;
|
||||||
private final int priority;
|
private final int priority;
|
||||||
|
@ -38,7 +39,8 @@ class ReplicationWork {
|
||||||
List<DatanodeStorageInfo> liveReplicaStorages, int additionalReplRequired,
|
List<DatanodeStorageInfo> liveReplicaStorages, int additionalReplRequired,
|
||||||
int priority) {
|
int priority) {
|
||||||
this.block = block;
|
this.block = block;
|
||||||
this.bc = bc;
|
this.srcPath = bc.getName();
|
||||||
|
this.storagePolicyID = bc.getStoragePolicyID();
|
||||||
this.srcNode = srcNode;
|
this.srcNode = srcNode;
|
||||||
this.srcNode.incrementPendingReplicationWithoutTargets();
|
this.srcNode.incrementPendingReplicationWithoutTargets();
|
||||||
this.containingNodes = containingNodes;
|
this.containingNodes = containingNodes;
|
||||||
|
@ -52,10 +54,10 @@ class ReplicationWork {
|
||||||
BlockStoragePolicySuite storagePolicySuite,
|
BlockStoragePolicySuite storagePolicySuite,
|
||||||
Set<Node> excludedNodes) {
|
Set<Node> excludedNodes) {
|
||||||
try {
|
try {
|
||||||
targets = blockplacement.chooseTarget(bc.getName(),
|
targets = blockplacement.chooseTarget(getSrcPath(),
|
||||||
additionalReplRequired, srcNode, liveReplicaStorages, false,
|
additionalReplRequired, srcNode, liveReplicaStorages, false,
|
||||||
excludedNodes, block.getNumBytes(),
|
excludedNodes, block.getNumBytes(),
|
||||||
storagePolicySuite.getPolicy(bc.getStoragePolicyID()), null);
|
storagePolicySuite.getPolicy(getStoragePolicyID()), null);
|
||||||
} finally {
|
} finally {
|
||||||
srcNode.decrementPendingReplicationWithoutTargets();
|
srcNode.decrementPendingReplicationWithoutTargets();
|
||||||
}
|
}
|
||||||
|
@ -84,4 +86,12 @@ class ReplicationWork {
|
||||||
public DatanodeDescriptor getSrcNode() {
|
public DatanodeDescriptor getSrcNode() {
|
||||||
return srcNode;
|
return srcNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getSrcPath() {
|
||||||
|
return srcPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte getStoragePolicyID() {
|
||||||
|
return storagePolicyID;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue