4242import org .apache .hadoop .hdfs .server .blockmanagement .BlockManager ;
4343import org .apache .hadoop .hdfs .server .blockmanagement .BlockManagerTestUtil ;
4444import org .apache .hadoop .hdfs .server .datanode .DataNode ;
45- import org .apache .hadoop .hdfs .server .datanode .DataNodeTestUtils ;
4645import org .apache .hadoop .hdfs .server .namenode .FSNamesystem ;
4746import org .apache .hadoop .hdfs .server .namenode .NameNode ;
4847import org .apache .hadoop .hdfs .server .namenode .NameNodeAdapter ;
@@ -70,7 +69,7 @@ public class TestStandbyIsHot {
7069 ((Log4JLogger )NameNode .stateChangeLog ).getLogger ().setLevel (Level .ALL );
7170 }
7271
73- @ Test
72+ @ Test ( timeout = 60000 )
7473 public void testStandbyIsHot () throws Exception {
7574 Configuration conf = new Configuration ();
7675 // We read from the standby to watch block locations
@@ -111,6 +110,8 @@ public void testStandbyIsHot() throws Exception {
111110 // Change replication
112111 LOG .info ("Changing replication to 1" );
113112 fs .setReplication (TEST_FILE_PATH , (short )1 );
113+ BlockManagerTestUtil .computeAllPendingWork (
114+ nn1 .getNamesystem ().getBlockManager ());
114115 waitForBlockLocations (cluster , nn1 , TEST_FILE , 1 );
115116
116117 nn1 .getRpcServer ().rollEditLog ();
@@ -121,6 +122,8 @@ public void testStandbyIsHot() throws Exception {
121122 // Change back to 3
122123 LOG .info ("Changing replication to 3" );
123124 fs .setReplication (TEST_FILE_PATH , (short )3 );
125+ BlockManagerTestUtil .computeAllPendingWork (
126+ nn1 .getNamesystem ().getBlockManager ());
124127 nn1 .getRpcServer ().rollEditLog ();
125128
126129 LOG .info ("Waiting for higher replication to show up on standby" );
@@ -142,7 +145,7 @@ public void testStandbyIsHot() throws Exception {
142145 * In the bug, the standby node would only very slowly notice the blocks returning
143146 * to the cluster.
144147 */
145- @ Test
148+ @ Test ( timeout = 60000 )
146149 public void testDatanodeRestarts () throws Exception {
147150 Configuration conf = new Configuration ();
148151 conf .setInt (DFSConfigKeys .DFS_BLOCK_SIZE_KEY , 1024 );
@@ -224,17 +227,16 @@ public Boolean get() {
224227
225228 LOG .info ("Got " + numReplicas + " locs: " + locs );
226229 if (numReplicas > expectedReplicas ) {
227- for (DataNode dn : cluster .getDataNodes ()) {
228- DataNodeTestUtils .triggerDeletionReport (dn );
229- }
230+ cluster .triggerDeletionReports ();
230231 }
232+ cluster .triggerHeartbeats ();
231233 return numReplicas == expectedReplicas ;
232234 } catch (IOException e ) {
233235 LOG .warn ("No block locations yet: " + e .getMessage ());
234236 return false ;
235237 }
236238 }
237- }, 500 , 10000 );
239+ }, 500 , 20000 );
238240
239241 }
240242}
0 commit comments