HDFS-9204. DatanodeDescriptor#PendingReplicationWithoutTargets is wrongly calculated. Contributed by Mingliang Liu.
This commit is contained in:
parent
0841940a21
commit
118a35bc2e
@ -356,6 +356,9 @@ Trunk (Unreleased)
|
||||
|
||||
HDFS-8800. hdfs --daemon stop namenode corrupts logs (John Smith via aw)
|
||||
|
||||
HDFS-9204. DatanodeDescriptor#PendingReplicationWithoutTargets is wrongly
|
||||
calculated. (Mingliang Liu via jing9)
|
||||
|
||||
BREAKDOWN OF HDFS-7285 SUBTASKS AND RELATED JIRAS
|
||||
|
||||
HDFS-7347. Configurable erasure coding policy for individual files and
|
||||
|
@ -256,7 +256,7 @@ public CachedBlocksList getPendingUncached() {
|
||||
private boolean disallowed = false;
|
||||
|
||||
// The number of replication work pending before targets are determined
|
||||
private int PendingReplicationWithoutTargets = 0;
|
||||
private int pendingReplicationWithoutTargets = 0;
|
||||
|
||||
// HB processing can use it to tell if it is the first HB since DN restarted
|
||||
private boolean heartbeatedSinceRegistration = false;
|
||||
@ -594,11 +594,11 @@ Iterator<BlockInfo> getBlockIterator(final String storageID) {
|
||||
}
|
||||
|
||||
void incrementPendingReplicationWithoutTargets() {
|
||||
PendingReplicationWithoutTargets++;
|
||||
pendingReplicationWithoutTargets++;
|
||||
}
|
||||
|
||||
void decrementPendingReplicationWithoutTargets() {
|
||||
PendingReplicationWithoutTargets--;
|
||||
pendingReplicationWithoutTargets--;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -651,7 +651,7 @@ void addBlocksToBeInvalidated(List<Block> blocklist) {
|
||||
* The number of work items that are pending to be replicated
|
||||
*/
|
||||
int getNumberOfBlocksToBeReplicated() {
|
||||
return PendingReplicationWithoutTargets + replicateBlocks.size();
|
||||
return pendingReplicationWithoutTargets + replicateBlocks.size();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -30,6 +30,9 @@ public ReplicationWork(BlockInfo block, BlockCollection bc,
|
||||
int priority) {
|
||||
super(block, bc, srcNodes, containingNodes,
|
||||
liveReplicaStorages, additionalReplRequired, priority);
|
||||
assert getSrcNodes().length == 1 :
|
||||
"There should be exactly 1 source node that have been selected";
|
||||
getSrcNodes()[0].incrementPendingReplicationWithoutTargets();
|
||||
BlockManager.LOG.debug("Creating a ReplicationWork to recover " + block);
|
||||
}
|
||||
|
||||
|
@ -31,6 +31,7 @@
|
||||
import org.apache.hadoop.hdfs.protocol.ExtendedBlock;
|
||||
import org.apache.hadoop.hdfs.server.datanode.DataNodeTestUtils;
|
||||
import org.junit.Test;
|
||||
import org.mockito.internal.util.reflection.Whitebox;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
@ -135,6 +136,10 @@ public void testNumberOfBlocksToBeReplicated() throws Exception {
|
||||
assertEquals(NUM_OF_BLOCKS, bm.getUnderReplicatedNotMissingBlocks());
|
||||
bm.computeDatanodeWork();
|
||||
|
||||
assertTrue("The number of replication work pending before targets are " +
|
||||
"determined should be non-negative.",
|
||||
(Integer)Whitebox.getInternalState(secondDn,
|
||||
"pendingReplicationWithoutTargets") >= 0);
|
||||
|
||||
assertTrue("The number of blocks to be replicated should be less than "
|
||||
+ "or equal to " + bm.replicationStreamsHardLimit,
|
||||
|
Loading…
Reference in New Issue
Block a user