hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From szets...@apache.org
Subject svn commit: r1325052 [3/3] - in /hadoop/common/branches/HDFS-3092/hadoop-hdfs-project: ./ hadoop-hdfs/ hadoop-hdfs/src/contrib/ hadoop-hdfs/src/contrib/fuse-dfs/ hadoop-hdfs/src/contrib/fuse-dfs/src/ hadoop-hdfs/src/main/java/ hadoop-hdfs/src/main/java...
Date Wed, 11 Apr 2012 22:51:15 GMT
Modified: hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestBootstrapStandby.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestBootstrapStandby.java?rev=1325052&r1=1325051&r2=1325052&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestBootstrapStandby.java
(original)
+++ hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestBootstrapStandby.java
Wed Apr 11 22:51:10 2012
@@ -17,6 +17,7 @@
  */
 package org.apache.hadoop.hdfs.server.namenode.ha;
 
+import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.IOException;
 import java.net.URI;
@@ -40,6 +41,7 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
+import com.google.common.base.Suppliers;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Lists;
 
@@ -170,7 +172,7 @@ public class TestBootstrapStandby {
       int rc = BootstrapStandby.run(
           new String[]{"-force"},
           cluster.getConfiguration(1));
-      assertEquals(1, rc);
+      assertEquals(BootstrapStandby.ERR_CODE_LOGS_UNAVAILABLE, rc);
     } finally {
       logs.stopCapturing();
     }
@@ -184,7 +186,7 @@ public class TestBootstrapStandby {
     int rc = BootstrapStandby.run(
         new String[]{"-nonInteractive"},
         cluster.getConfiguration(1));
-    assertEquals(1, rc);
+    assertEquals(BootstrapStandby.ERR_CODE_ALREADY_FORMATTED, rc);
 
     // Should pass with -force
     rc = BootstrapStandby.run(
@@ -192,6 +194,24 @@ public class TestBootstrapStandby {
         cluster.getConfiguration(1));
     assertEquals(0, rc);
   }
+  
+  @Test(timeout=30000)
+  public void testOtherNodeNotActive() throws Exception {
+    cluster.transitionToStandby(0);
+    int rc = BootstrapStandby.run(
+        new String[]{"-nonInteractive"},
+        cluster.getConfiguration(1));
+    assertEquals(BootstrapStandby.ERR_CODE_OTHER_NN_NOT_ACTIVE, rc);
+    
+    // Answer "yes" to the prompt about transition to active
+    System.setIn(new ByteArrayInputStream("yes\n".getBytes()));
+    rc = BootstrapStandby.run(
+        new String[]{"-force"},
+        cluster.getConfiguration(1));
+    assertEquals(0, rc);
+    
+    assertFalse(nn0.getNamesystem().isInStandbyState());
+  }
 
   private void assertNNFilesMatch() throws Exception {
     List<File> curDirs = Lists.newArrayList();

Modified: hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestInitializeSharedEdits.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestInitializeSharedEdits.java?rev=1325052&r1=1325051&r2=1325052&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestInitializeSharedEdits.java
(original)
+++ hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestInitializeSharedEdits.java
Wed Apr 11 22:51:10 2012
@@ -25,6 +25,8 @@ import org.apache.hadoop.conf.Configurat
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.FileUtil;
 import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hdfs.DFSConfigKeys;
+import org.apache.hadoop.hdfs.DFSUtil;
 import org.apache.hadoop.hdfs.MiniDFSCluster;
 import org.apache.hadoop.hdfs.MiniDFSNNTopology;
 import org.apache.hadoop.hdfs.server.namenode.NameNode;
@@ -117,4 +119,17 @@ public class TestInitializeSharedEdits {
     assertFalse(NameNode.initializeSharedEdits(conf, false));
     assertTrue(NameNode.initializeSharedEdits(conf, false));
   }
+  
+  @Test
+  public void testInitializeSharedEditsConfiguresGenericConfKeys() {
+    Configuration conf = new Configuration();
+    conf.set(DFSConfigKeys.DFS_FEDERATION_NAMESERVICES, "ns1");
+    conf.set(DFSUtil.addKeySuffixes(DFSConfigKeys.DFS_HA_NAMENODES_KEY_PREFIX,
+        "ns1"), "nn1,nn2");
+    conf.set(DFSUtil.addKeySuffixes(DFSConfigKeys.DFS_NAMENODE_RPC_ADDRESS_KEY,
+        "ns1", "nn1"), "localhost:1234");
+    assertNull(conf.get(DFSConfigKeys.DFS_NAMENODE_RPC_ADDRESS_KEY));
+    NameNode.initializeSharedEdits(conf);
+    assertNotNull(conf.get(DFSConfigKeys.DFS_NAMENODE_RPC_ADDRESS_KEY));
+  }
 }

Modified: hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/test/MiniDFSClusterManager.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/test/MiniDFSClusterManager.java?rev=1325052&r1=1325051&r2=1325052&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/test/MiniDFSClusterManager.java
(original)
+++ hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/test/MiniDFSClusterManager.java
Wed Apr 11 22:51:10 2012
@@ -68,6 +68,7 @@ public class MiniDFSClusterManager {
   private StartupOption dfsOpts;
   private String writeConfig;
   private Configuration conf;
+  private boolean format;
   
   private static final long SLEEP_INTERVAL_MS = 1000 * 60;
 
@@ -138,6 +139,7 @@ public class MiniDFSClusterManager {
     dfs = new MiniDFSCluster.Builder(conf).nameNodePort(nameNodePort)
                                           .numDataNodes(numDataNodes)
                                           .startupOption(dfsOpts)
+                                          .format(format)
                                           .build();
     dfs.waitActive();
     
@@ -196,8 +198,13 @@ public class MiniDFSClusterManager {
     // HDFS
     numDataNodes = intArgument(cli, "datanodes", 1);
     nameNodePort = intArgument(cli, "nnport", 0);
-    dfsOpts = cli.hasOption("format") ?
-        StartupOption.FORMAT : StartupOption.REGULAR;
+    if (cli.hasOption("format")) {
+      dfsOpts = StartupOption.FORMAT;
+      format = true;
+    } else {
+      dfsOpts = StartupOption.REGULAR;
+      format = false;
+    }
 
     // Runner
     writeDetails = cli.getOptionValue("writeDetails");

Modified: hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/pom.xml
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/pom.xml?rev=1325052&r1=1325051&r2=1325052&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/pom.xml (original)
+++ hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/pom.xml Wed Apr 11 22:51:10 2012
@@ -31,6 +31,7 @@
     <module>hadoop-hdfs</module>
     <module>hadoop-hdfs-httpfs</module>
     <module>hadoop-hdfs/src/contrib/bkjournal</module>
+    <module>hadoop-hdfs/src/contrib/fuse-dfs</module>
   </modules>
 
   <build>



Mime
View raw message