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 2011/04/20 21:07:43 UTC

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

Author: apurtell
Date: Wed Apr 20 19:07:43 2011
New Revision: 1095485

URL: http://svn.apache.org/viewvc?rev=1095485&view=rev
Log:
HBASE-3800  HMaster is not able to start due to AlreadyCreatedException

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

Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1095485&r1=1095484&r2=1095485&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Wed Apr 20 19:07:43 2011
@@ -79,6 +79,7 @@ Release 0.91.0 - Unreleased
    HBASE-3781  hbase shell cannot start "NoMethodError: undefined method
                `close' for nil:NilClass" (Mikael Sitruk)
    HBASE-3802  Redundant list creation in HRegion
+   HBASE-3800  HMaster is not able to start due to AlreadyCreatedException
 
   IMPROVEMENTS
    HBASE-3290  Max Compaction Size (Nicolas Spiegelberg via Stack)  

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java?rev=1095485&r1=1095484&r2=1095485&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java Wed Apr 20 19:07:43 2011
@@ -250,26 +250,26 @@ public class FSUtils {
    */
   public static void setVersion(FileSystem fs, Path rootdir, String version,
       int wait) throws IOException {
-    while (true) try {
-      FSDataOutputStream s =
-        fs.create(new Path(rootdir, HConstants.VERSION_FILE_NAME));
-      s.writeUTF(version);
-      s.close();
-      LOG.debug("Created version file at " + rootdir.toString() +
-        " set its version at:" + version);
-      return;
-    } catch (IOException e) {
-      if (wait > 0) {
-        LOG.warn("Unable to create version file at " + rootdir.toString() +
-          ", retrying: " + StringUtils.stringifyException(e));
-        try {
-          Thread.sleep(wait);
-        } catch (InterruptedException ex) {
-          // ignore
-        }
-      } else {
-        // rethrow
-        throw e;
+    Path versionFile = new Path(rootdir, HConstants.VERSION_FILE_NAME);
+    while (true) {
+      try {
+        FSDataOutputStream s = fs.create(versionFile);
+        s.writeUTF(version);
+        LOG.debug("Created version file at " + rootdir.toString() +
+            " set its version at:" + version);
+        s.close();
+        return;
+      } catch (IOException e) {
+        if (wait > 0) {
+          LOG.warn("Unable to create version file at " + rootdir.toString() +
+              ", retrying: " + e.getMessage());
+          fs.delete(versionFile, false);
+          try {
+            Thread.sleep(wait);
+          } catch (InterruptedException ex) {
+            // ignore
+          }
+        }
       }
     }
   }