You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2009/12/18 02:33:27 UTC

svn commit: r892072 - in /hadoop/hbase/trunk: CHANGES.txt src/java/org/apache/hadoop/hbase/util/FSUtils.java

Author: apurtell
Date: Fri Dec 18 01:33:25 2009
New Revision: 892072

URL: http://svn.apache.org/viewvc?rev=892072&view=rev
Log:
HBASE-1960 Master should wait for DFS to come up when creating hbase.version

Modified:
    hadoop/hbase/trunk/CHANGES.txt
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/util/FSUtils.java

Modified: hadoop/hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/CHANGES.txt?rev=892072&r1=892071&r2=892072&view=diff
==============================================================================
--- hadoop/hbase/trunk/CHANGES.txt (original)
+++ hadoop/hbase/trunk/CHANGES.txt Fri Dec 18 01:33:25 2009
@@ -131,6 +131,8 @@
    HBASE-2048  Small inconsistency in the "Example API Usage"
                (Benoit Sigoure via JD)
    HBASE-2044  HBASE-1822 removed not-deprecated APIs
+   HBASE-1960  Master should wait for DFS to come up when creating
+               hbase.version
 
   IMPROVEMENTS
    HBASE-1760  Cleanup TODOs in HTable

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/util/FSUtils.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/util/FSUtils.java?rev=892072&r1=892071&r2=892072&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/util/FSUtils.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/util/FSUtils.java Fri Dec 18 01:33:25 2009
@@ -20,7 +20,6 @@
 package org.apache.hadoop.hbase.util;
 
 import java.io.DataInputStream;
-import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.net.URI;
 import java.net.URISyntaxException;
@@ -249,10 +248,20 @@
     FileSystem fs = FileSystem.get(conf);
     if (!(fs instanceof DistributedFileSystem)) return;
     DistributedFileSystem dfs = (DistributedFileSystem)fs;
+    // Are there any data nodes up yet?
+    // Currently the safe mode check falls through if the namenode is up but no
+    // datanodes have reported in yet.
+    while (dfs.getDataNodeStats().length == 0) {
+      LOG.info("Waiting for dfs to come up...");
+      try {
+        Thread.sleep(wait);
+      } catch (InterruptedException e) {
+        //continue
+      }
+    }
     // Make sure dfs is not in safe mode
-    String message = "Waiting for dfs to exit safe mode...";
     while (dfs.setSafeMode(FSConstants.SafeModeAction.SAFEMODE_GET)) {
-      LOG.info(message);
+      LOG.info("Waiting for dfs to exit safe mode...");
       try {
         Thread.sleep(wait);
       } catch (InterruptedException e) {