117
117
import org .apache .hadoop .hdfs .server .blockmanagement .BlockManagerTestUtil ;
118
118
import org .apache .hadoop .hdfs .server .blockmanagement .BlockPlacementPolicy ;
119
119
import org .apache .hadoop .hdfs .server .blockmanagement .BlockPlacementPolicyRackFaultTolerant ;
120
+ import org .apache .hadoop .hdfs .server .common .HdfsServerConstants .BlockUCState ;
120
121
import org .apache .hadoop .hdfs .server .datanode .DataNode ;
121
122
import org .apache .hadoop .hdfs .server .datanode .DataNodeTestUtils ;
122
123
import org .apache .hadoop .hdfs .server .datanode .fsdataset .FsDatasetSpi ;
@@ -2808,6 +2809,7 @@ public void testECAddExpectedReplicasToPending() throws Exception {
2808
2809
for (int i = 0 ; i < 1024 * 1024 ; i ++) {
2809
2810
str .write (i );
2810
2811
}
2812
+ str .flush ();
2811
2813
// Wait for dn2 IBR.
2812
2814
Thread .sleep (2000 );
2813
2815
}
@@ -2824,25 +2826,11 @@ public void testECAddExpectedReplicasToPending() throws Exception {
2824
2826
// Wait for dn0 dn1 IBR.
2825
2827
Thread .sleep (2000 );
2826
2828
pendingNum = BlockManagerTestUtil .getNumReplicasInPendingReconstruction (blockManager ,blockInfo );
2827
- assertEquals (1 , pendingNum );
2828
-
2829
- long timeoutNum = 0 ;
2830
- // Wait for pendingReconstruction timeout because the block group only has two replicas.
2831
- while (timeoutNum == 0 ) {
2832
- timeoutNum = blockManager .getNumTimedOutPendingReconstructions ();
2833
- }
2834
- pendingNum = BlockManagerTestUtil .getNumReplicasInPendingReconstruction (blockManager ,blockInfo );
2835
2829
assertEquals (0 , pendingNum );
2836
- blockInfo = (BlockInfoStriped )blockManager .getStoredBlock (locatedBlocks .getLocatedBlocks ().get (0 ).getBlock ().getLocalBlock ());
2837
- assertEquals (2 , blockInfo .numNodes ());
2838
-
2839
2830
2840
- // Wait for pendingReconstruction timeout blocks to needReconstruction
2841
- Thread .sleep (3000 * 2 );
2842
- pendingNum = BlockManagerTestUtil .getNumReplicasInPendingReconstruction (blockManager ,blockInfo );
2843
- assertEquals (0 , pendingNum );
2844
2831
blockInfo = (BlockInfoStriped )blockManager .getStoredBlock (locatedBlocks .getLocatedBlocks ().get (0 ).getBlock ().getLocalBlock ());
2845
2832
assertEquals (2 , blockInfo .numNodes ());
2833
+ assertEquals (BlockUCState .COMPLETE , blockInfo .getBlockUCState ());
2846
2834
}
2847
2835
}
2848
2836
0 commit comments