You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by om...@apache.org on 2011/03/04 05:24:21 UTC
svn commit: r1077526 -
/hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/hdfs/server/namenode/TestDeadDatanode.java
Author: omalley
Date: Fri Mar 4 04:24:21 2011
New Revision: 1077526
URL: http://svn.apache.org/viewvc?rev=1077526&view=rev
Log:
commit b8bdc99139116e60bcb459297174bdca166fb95f
Author: Suresh Srinivas <su...@yahoo-inc.com>
Date: Fri Jul 2 16:30:01 2010 -0700
HDFS-1250 from https://issues.apache.org/jira/secure/attachment/12448525/HDFS-1250.y20.patch
Modified:
hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/hdfs/server/namenode/TestDeadDatanode.java
Modified: hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/hdfs/server/namenode/TestDeadDatanode.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/hdfs/server/namenode/TestDeadDatanode.java?rev=1077526&r1=1077525&r2=1077526&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/hdfs/server/namenode/TestDeadDatanode.java (original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/hdfs/server/namenode/TestDeadDatanode.java Fri Mar 4 04:24:21 2011
@@ -26,9 +26,9 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hdfs.DFSConfigKeys;
-import org.apache.hadoop.hdfs.HdfsConfiguration;
import org.apache.hadoop.hdfs.MiniDFSCluster;
import org.apache.hadoop.hdfs.protocol.Block;
+import org.apache.hadoop.hdfs.protocol.DatanodeID;
import org.apache.hadoop.hdfs.server.datanode.DataNode;
import org.apache.hadoop.hdfs.server.namenode.FSNamesystem;
import org.apache.hadoop.hdfs.server.protocol.DatanodeCommand;
@@ -54,10 +54,10 @@ public class TestDeadDatanode {
* wait for datanode to reach alive or dead state for waitTime given in
* milliseconds.
*/
- private void waitForDatanodeState(String nodeID, boolean alive, int waitTime)
- throws TimeoutException, InterruptedException {
+ private void waitForDatanodeState(DatanodeID nodeID, boolean alive, int waitTime)
+ throws TimeoutException, InterruptedException, IOException {
long stopTime = System.currentTimeMillis() + waitTime;
- FSNamesystem namesystem = cluster.getNamesystem();
+ FSNamesystem namesystem = cluster.getNameNode().getNamesystem();
String state = alive ? "alive" : "dead";
while (System.currentTimeMillis() < stopTime) {
if (namesystem.getDatanode(nodeID).isAlive == alive) {
@@ -80,8 +80,8 @@ public class TestDeadDatanode {
*/
@Test
public void testDeadDatanode() throws Exception {
- Configuration conf = new HdfsConfiguration();
- conf.setInt(DFSConfigKeys.DFS_NAMENODE_HEARTBEAT_RECHECK_INTERVAL_KEY, 500);
+ Configuration conf = new Configuration();
+ conf.setInt("heartbeat.recheck.interval", 500);
conf.setLong(DFSConfigKeys.DFS_HEARTBEAT_INTERVAL_KEY, 1L);
cluster = new MiniDFSCluster(conf, 1, true, null);
cluster.waitActive();
@@ -89,12 +89,12 @@ public class TestDeadDatanode {
// wait for datanode to be marked live
DataNode dn = cluster.getDataNodes().get(0);
DatanodeRegistration reg = cluster.getDataNodes().get(0)
- .getDatanodeRegistration();
- waitForDatanodeState(reg.getStorageID(), true, 20000);
+ .dnRegistration;
+ waitForDatanodeState(reg, true, 20000);
// Shutdown and wait for datanode to be marked dead
dn.shutdown();
- waitForDatanodeState(reg.getStorageID(), false, 20000);
+ waitForDatanodeState(reg, false, 20000);
DatanodeProtocol dnp = cluster.getNameNode();
Block block = new Block(0);