HDFS-10453. ReplicationMonitor thread could stuck for long time due to the race between replication and delete of same file in a large cluster.. Contributed by He Xiaoqiao.
This commit is contained in:
parent
8cf88fcd1f
commit
96bb6a51ec
|
@ -33,6 +33,7 @@ abstract class BlockReconstructionWork {
|
||||||
private final BlockInfo block;
|
private final BlockInfo block;
|
||||||
|
|
||||||
private final String srcPath;
|
private final String srcPath;
|
||||||
|
private final long blockSize;
|
||||||
private final byte storagePolicyID;
|
private final byte storagePolicyID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -59,6 +60,7 @@ abstract class BlockReconstructionWork {
|
||||||
int priority) {
|
int priority) {
|
||||||
this.block = block;
|
this.block = block;
|
||||||
this.srcPath = bc.getName();
|
this.srcPath = bc.getName();
|
||||||
|
this.blockSize = block.getNumBytes();
|
||||||
this.storagePolicyID = bc.getStoragePolicyID();
|
this.storagePolicyID = bc.getStoragePolicyID();
|
||||||
this.srcNodes = srcNodes;
|
this.srcNodes = srcNodes;
|
||||||
this.containingNodes = containingNodes;
|
this.containingNodes = containingNodes;
|
||||||
|
@ -100,6 +102,10 @@ abstract class BlockReconstructionWork {
|
||||||
return srcPath;
|
return srcPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long getBlockSize() {
|
||||||
|
return blockSize;
|
||||||
|
}
|
||||||
|
|
||||||
public byte getStoragePolicyID() {
|
public byte getStoragePolicyID() {
|
||||||
return storagePolicyID;
|
return storagePolicyID;
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,8 +59,7 @@ class ErasureCodingWork extends BlockReconstructionWork {
|
||||||
// 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(
|
||||||
getSrcPath(), getAdditionalReplRequired(), getSrcNodes()[0],
|
getSrcPath(), getAdditionalReplRequired(), getSrcNodes()[0],
|
||||||
getLiveReplicaStorages(), false, excludedNodes,
|
getLiveReplicaStorages(), false, excludedNodes, getBlockSize(),
|
||||||
getBlock().getNumBytes(),
|
|
||||||
storagePolicySuite.getPolicy(getStoragePolicyID()), null);
|
storagePolicySuite.getPolicy(getStoragePolicyID()), null);
|
||||||
setTargets(chosenTargets);
|
setTargets(chosenTargets);
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,10 +45,8 @@ class ReplicationWork extends BlockReconstructionWork {
|
||||||
try {
|
try {
|
||||||
DatanodeStorageInfo[] chosenTargets = blockplacement.chooseTarget(
|
DatanodeStorageInfo[] chosenTargets = blockplacement.chooseTarget(
|
||||||
getSrcPath(), getAdditionalReplRequired(), getSrcNodes()[0],
|
getSrcPath(), getAdditionalReplRequired(), getSrcNodes()[0],
|
||||||
getLiveReplicaStorages(), false, excludedNodes,
|
getLiveReplicaStorages(), false, excludedNodes, getBlockSize(),
|
||||||
getBlock().getNumBytes(),
|
storagePolicySuite.getPolicy(getStoragePolicyID()), null);
|
||||||
storagePolicySuite.getPolicy(getStoragePolicyID()),
|
|
||||||
null);
|
|
||||||
setTargets(chosenTargets);
|
setTargets(chosenTargets);
|
||||||
} finally {
|
} finally {
|
||||||
getSrcNodes()[0].decrementPendingReplicationWithoutTargets();
|
getSrcNodes()[0].decrementPendingReplicationWithoutTargets();
|
||||||
|
|
Loading…
Reference in New Issue