hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject svn commit: r1227284 - in /hadoop/common/branches/HDFS-1623/hadoop-hdfs-project/hadoop-hdfs: CHANGES.HDFS-1623.txt src/test/java/org/apache/hadoop/hdfs/MiniDFSCluster.java
Date Wed, 04 Jan 2012 19:50:42 GMT
Author: todd
Date: Wed Jan  4 19:50:41 2012
New Revision: 1227284

URL: http://svn.apache.org/viewvc?rev=1227284&view=rev
Log:
HDFS-2720. Fix MiniDFSCluster HA support to work properly on Windows. Contributed by Uma Maheswara
Rao G.

Modified:
    hadoop/common/branches/HDFS-1623/hadoop-hdfs-project/hadoop-hdfs/CHANGES.HDFS-1623.txt
    hadoop/common/branches/HDFS-1623/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/MiniDFSCluster.java

Modified: hadoop/common/branches/HDFS-1623/hadoop-hdfs-project/hadoop-hdfs/CHANGES.HDFS-1623.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-1623/hadoop-hdfs-project/hadoop-hdfs/CHANGES.HDFS-1623.txt?rev=1227284&r1=1227283&r2=1227284&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-1623/hadoop-hdfs-project/hadoop-hdfs/CHANGES.HDFS-1623.txt
(original)
+++ hadoop/common/branches/HDFS-1623/hadoop-hdfs-project/hadoop-hdfs/CHANGES.HDFS-1623.txt
Wed Jan  4 19:50:41 2012
@@ -81,3 +81,5 @@ HDFS-2714. Fix test cases which use stan
 HDFS-2692. Fix bugs related to failover from/into safe mode. (todd)
 
 HDFS-2716. Configuration needs to allow different dfs.http.addresses for each HA NN (todd)
+
+HDFS-2720. Fix MiniDFSCluster HA support to work properly on Windows. (Uma Maheswara Rao
G via todd)

Modified: hadoop/common/branches/HDFS-1623/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/MiniDFSCluster.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-1623/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/MiniDFSCluster.java?rev=1227284&r1=1227283&r2=1227284&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-1623/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/MiniDFSCluster.java
(original)
+++ hadoop/common/branches/HDFS-1623/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/MiniDFSCluster.java
Wed Jan  4 19:50:41 2012
@@ -601,10 +601,13 @@ public class MiniDFSCluster {
         }
       }
 
-      // Now start all the NNs in this nameservice.
+      // Now format first NN and copy the storage directory from that node to the others.
       int i = 0;
+      Collection<URI> prevNNDirs = null;
+      int nnCounterForFormat = nnCounter;
       for (NNConf nn : nameservice.getNNs()) {
-        initNameNodeConf(conf, nsId, nn.getNnId(), manageNameDfsDirs, nnCounter);
+        initNameNodeConf(conf, nsId, nn.getNnId(), manageNameDfsDirs,
+            nnCounterForFormat);
         
         boolean formatThisOne = format;
         if (format && i++ > 0) {
@@ -613,11 +616,21 @@ public class MiniDFSCluster {
           // block pool ID, etc. Instead, copy the name dirs
           // from the first one.
           formatThisOne = false;
-          copyNameDirs(getConfiguration(nnCounter - 1), conf);
+          assert (null != prevNNDirs);
+          copyNameDirs(prevNNDirs, FSNamesystem.getNamespaceDirs(conf), conf);
         }
         
-        createNameNode(nnCounter++, conf, numDataNodes, formatThisOne,
-            operation, clusterId, nsId, nn.getNnId());
+        nnCounterForFormat++;
+        if (formatThisOne) {
+          NameNode.format(conf);
+        }
+        prevNNDirs = FSNamesystem.getNamespaceDirs(conf);
+      }
+      // Start all Namenodes
+      for (NNConf nn : nameservice.getNNs()) {
+        initNameNodeConf(conf, nsId, nn.getNnId(), manageNameDfsDirs, nnCounter);
+        createNameNode(nnCounter++, conf, numDataNodes, false, operation,
+            clusterId, nsId, nn.getNnId());
       }
       
     }
@@ -655,10 +668,8 @@ public class MiniDFSCluster {
     }
   }
 
-  private void copyNameDirs(Configuration srcConf, Configuration dstConf)
-      throws IOException {
-    Collection<URI> srcDirs = FSNamesystem.getNamespaceDirs(srcConf);
-    Collection<URI> dstDirs = FSNamesystem.getNamespaceDirs(dstConf);
+  private void copyNameDirs(Collection<URI> srcDirs, Collection<URI> dstDirs,
+      Configuration dstConf) throws IOException {
     URI srcDir = Lists.newArrayList(srcDirs).get(0);
     FileSystem dstFS = FileSystem.getLocal(dstConf).getRaw();
     for (URI dstDir : dstDirs) {



Mime
View raw message