HDFS-3422. TestStandbyIsHot timeouts too aggressive. Contributed by Todd Lipcon.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1339450 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Todd Lipcon 2012-05-17 02:45:34 +00:00
parent 3f844f50dd
commit d62694d97f
2 changed files with 11 additions and 7 deletions

View File

@ -60,6 +60,8 @@ Release 2.0.1-alpha - UNRELEASED
HDFS-3413. TestFailureToReadEdits timing out. (atm) HDFS-3413. TestFailureToReadEdits timing out. (atm)
HDFS-3422. TestStandbyIsHot timeouts too aggressive (todd)
Release 2.0.0-alpha - UNRELEASED Release 2.0.0-alpha - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -42,7 +42,6 @@ import org.apache.hadoop.hdfs.protocol.LocatedBlocks;
import org.apache.hadoop.hdfs.server.blockmanagement.BlockManager; import org.apache.hadoop.hdfs.server.blockmanagement.BlockManager;
import org.apache.hadoop.hdfs.server.blockmanagement.BlockManagerTestUtil; import org.apache.hadoop.hdfs.server.blockmanagement.BlockManagerTestUtil;
import org.apache.hadoop.hdfs.server.datanode.DataNode; import org.apache.hadoop.hdfs.server.datanode.DataNode;
import org.apache.hadoop.hdfs.server.datanode.DataNodeTestUtils;
import org.apache.hadoop.hdfs.server.namenode.FSNamesystem; import org.apache.hadoop.hdfs.server.namenode.FSNamesystem;
import org.apache.hadoop.hdfs.server.namenode.NameNode; import org.apache.hadoop.hdfs.server.namenode.NameNode;
import org.apache.hadoop.hdfs.server.namenode.NameNodeAdapter; import org.apache.hadoop.hdfs.server.namenode.NameNodeAdapter;
@ -70,7 +69,7 @@ public class TestStandbyIsHot {
((Log4JLogger)NameNode.stateChangeLog).getLogger().setLevel(Level.ALL); ((Log4JLogger)NameNode.stateChangeLog).getLogger().setLevel(Level.ALL);
} }
@Test @Test(timeout=60000)
public void testStandbyIsHot() throws Exception { public void testStandbyIsHot() throws Exception {
Configuration conf = new Configuration(); Configuration conf = new Configuration();
// We read from the standby to watch block locations // We read from the standby to watch block locations
@ -111,6 +110,8 @@ public class TestStandbyIsHot {
// Change replication // Change replication
LOG.info("Changing replication to 1"); LOG.info("Changing replication to 1");
fs.setReplication(TEST_FILE_PATH, (short)1); fs.setReplication(TEST_FILE_PATH, (short)1);
BlockManagerTestUtil.computeAllPendingWork(
nn1.getNamesystem().getBlockManager());
waitForBlockLocations(cluster, nn1, TEST_FILE, 1); waitForBlockLocations(cluster, nn1, TEST_FILE, 1);
nn1.getRpcServer().rollEditLog(); nn1.getRpcServer().rollEditLog();
@ -121,6 +122,8 @@ public class TestStandbyIsHot {
// Change back to 3 // Change back to 3
LOG.info("Changing replication to 3"); LOG.info("Changing replication to 3");
fs.setReplication(TEST_FILE_PATH, (short)3); fs.setReplication(TEST_FILE_PATH, (short)3);
BlockManagerTestUtil.computeAllPendingWork(
nn1.getNamesystem().getBlockManager());
nn1.getRpcServer().rollEditLog(); nn1.getRpcServer().rollEditLog();
LOG.info("Waiting for higher replication to show up on standby"); LOG.info("Waiting for higher replication to show up on standby");
@ -142,7 +145,7 @@ public class TestStandbyIsHot {
* In the bug, the standby node would only very slowly notice the blocks returning * In the bug, the standby node would only very slowly notice the blocks returning
* to the cluster. * to the cluster.
*/ */
@Test @Test(timeout=60000)
public void testDatanodeRestarts() throws Exception { public void testDatanodeRestarts() throws Exception {
Configuration conf = new Configuration(); Configuration conf = new Configuration();
conf.setInt(DFSConfigKeys.DFS_BLOCK_SIZE_KEY, 1024); conf.setInt(DFSConfigKeys.DFS_BLOCK_SIZE_KEY, 1024);
@ -224,17 +227,16 @@ public class TestStandbyIsHot {
LOG.info("Got " + numReplicas + " locs: " + locs); LOG.info("Got " + numReplicas + " locs: " + locs);
if (numReplicas > expectedReplicas) { if (numReplicas > expectedReplicas) {
for (DataNode dn : cluster.getDataNodes()) { cluster.triggerDeletionReports();
DataNodeTestUtils.triggerDeletionReport(dn);
}
} }
cluster.triggerHeartbeats();
return numReplicas == expectedReplicas; return numReplicas == expectedReplicas;
} catch (IOException e) { } catch (IOException e) {
LOG.warn("No block locations yet: " + e.getMessage()); LOG.warn("No block locations yet: " + e.getMessage());
return false; return false;
} }
} }
}, 500, 10000); }, 500, 20000);
} }
} }