Skip to content

Commit 0f74e69

Browse files
committed
HDFS-3422. TestStandbyIsHot timeouts too aggressive. Contributed by Todd Lipcon.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1339452 13f79535-47bb-0310-9956-ffa450edef68
1 parent 1e77ba1 commit 0f74e69

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,8 @@ Release 2.0.1-alpha - UNRELEASED
206206

207207
HDFS-3413. TestFailureToReadEdits timing out. (atm)
208208

209+
HDFS-3422. TestStandbyIsHot timeouts too aggressive (todd)
210+
209211
Release 2.0.0-alpha - UNRELEASED
210212

211213
INCOMPATIBLE CHANGES

hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestStandbyIsHot.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
import org.apache.hadoop.hdfs.server.blockmanagement.BlockManager;
4343
import org.apache.hadoop.hdfs.server.blockmanagement.BlockManagerTestUtil;
4444
import org.apache.hadoop.hdfs.server.datanode.DataNode;
45-
import org.apache.hadoop.hdfs.server.datanode.DataNodeTestUtils;
4645
import org.apache.hadoop.hdfs.server.namenode.FSNamesystem;
4746
import org.apache.hadoop.hdfs.server.namenode.NameNode;
4847
import 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

Comments
 (0)