Skip to content

Commit f1ac383

Browse files
committed
update ut
1 parent 535d712 commit f1ac383

File tree

1 file changed

+24
-0
lines changed
  • hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement

1 file changed

+24
-0
lines changed

hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestBlockManager.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2444,6 +2444,30 @@ public void testScheduleReconstructionStriped() throws Exception {
24442444
storageList.get(0).getDatanodeDescriptor().decrementPendingReplicationWithoutTargets();
24452445
}
24462446

2447+
// Case 1.7: If no block is missing, but three block are busy, and the other block
2448+
// is decommissioning. we should get replication work.
2449+
clearStorageForStripedBlock(stripedBlock);
2450+
addStorageForStripedBlock(stripedBlock, storageList.subList(0, 5),
2451+
blockIndices.subList(0, 5));
2452+
storageList.get(0).getDatanodeDescriptor().startDecommission();
2453+
for (int m = 1; m < 4; m++) {
2454+
for (int i = 0; i < bm.getReplicationStreamsHardLimit(); i++) {
2455+
storageList.get(m).getDatanodeDescriptor().incrementPendingReplicationWithoutTargets();
2456+
}
2457+
}
2458+
replWork = (ErasureCodingReplicationWork) bm.scheduleReconstruction(stripedBlock, 0);
2459+
assertEquals(1, replWork.getAdditionalReplRequired());
2460+
assertEquals(1, replWork.getSrcNodes().length);
2461+
assertEquals(storageList.get(0).getDatanodeDescriptor(), replWork.getSrcNodes()[0]);
2462+
assertEquals(1, replWork.getSrcIndices().length);
2463+
assertEquals(0, (byte) replWork.getSrcIndices()[0]);
2464+
updateDataNodeAdminState(storageList.get(0).getDatanodeDescriptor(), AdminStates.NORMAL);
2465+
for (int m = 1; m < 4; m++) {
2466+
for (int i = 0; i < bm.getReplicationStreamsHardLimit(); i++) {
2467+
storageList.get(m).getDatanodeDescriptor().decrementPendingReplicationWithoutTargets();
2468+
}
2469+
}
2470+
24472471
// Case 2: One block is missing
24482472
// Case 2.1: If one block is missing, we will get one ErasureCodingWork, and require one replicas
24492473
clearStorageForStripedBlock(stripedBlock);

0 commit comments

Comments
 (0)