You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by te...@apache.org on 2011/12/28 06:57:53 UTC

svn commit: r1225103 - in /hbase/branches/0.90: CHANGES.txt src/main/java/org/apache/hadoop/hbase/io/Reference.java src/main/java/org/apache/hadoop/hbase/regionserver/SplitTransaction.java

Author: tedyu
Date: Wed Dec 28 05:57:53 2011
New Revision: 1225103

URL: http://svn.apache.org/viewvc?rev=1225103&view=rev
Log:
HBASE-5009  Failure of creating split dir if it already exists prevents splits from happening further (Ramkrishna)

Modified:
    hbase/branches/0.90/CHANGES.txt
    hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/io/Reference.java
    hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/regionserver/SplitTransaction.java

Modified: hbase/branches/0.90/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/CHANGES.txt?rev=1225103&r1=1225102&r2=1225103&view=diff
==============================================================================
--- hbase/branches/0.90/CHANGES.txt (original)
+++ hbase/branches/0.90/CHANGES.txt Wed Dec 28 05:57:53 2011
@@ -10,6 +10,7 @@ Release 0.90.6 - Unreleased
    HBASE-5060  HBase client is blocked forever (Jinchao)
    HBASE-5073  Registered listeners not getting removed leading to memory leak in HBaseAdmin
                (Ramkrishna)
+   HBASE-5009  Failure of creating split dir if it already exists prevents splits from happening further
 
 Release 0.90.5 - Dec 22, 2011
   BUG FIXES

Modified: hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/io/Reference.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/io/Reference.java?rev=1225103&r1=1225102&r2=1225103&view=diff
==============================================================================
--- hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/io/Reference.java (original)
+++ hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/io/Reference.java Wed Dec 28 05:57:53 2011
@@ -125,8 +125,7 @@ public class Reference implements Writab
 
   public Path write(final FileSystem fs, final Path p)
   throws IOException {
-    FSUtils.create(fs, p);
-    FSDataOutputStream out = fs.create(p);
+    FSDataOutputStream out = fs.create(p, false);
     try {
       write(out);
     } finally {
@@ -153,4 +152,4 @@ public class Reference implements Writab
       in.close();
     }
   }
-}
\ No newline at end of file
+}

Modified: hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/regionserver/SplitTransaction.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/regionserver/SplitTransaction.java?rev=1225103&r1=1225102&r2=1225103&view=diff
==============================================================================
--- hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/regionserver/SplitTransaction.java (original)
+++ hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/regionserver/SplitTransaction.java Wed Dec 28 05:57:53 2011
@@ -411,7 +411,14 @@ class SplitTransaction {
    */
   private static void createSplitDir(final FileSystem fs, final Path splitdir)
   throws IOException {
-    if (fs.exists(splitdir)) throw new IOException("Splitdir already exits? " + splitdir);
+    if (fs.exists(splitdir)) {
+      LOG.info("The " + splitdir
+          + " directory exists.  Hence deleting it to recreate it");
+      if (!fs.delete(splitdir, true)) {
+        throw new IOException("Failed deletion of " + splitdir
+            + " before creating them again.");
+      }
+    }
     if (!fs.mkdirs(splitdir)) throw new IOException("Failed create of " + splitdir);
   }
 
@@ -471,6 +478,10 @@ class SplitTransaction {
           this.fileSplitTimeout, TimeUnit.MILLISECONDS);
       if (stillRunning) {
         threadPool.shutdownNow();
+        // wait for the thread to shutdown completely.
+        while (!threadPool.isTerminated()) {
+          Thread.sleep(50);
+        }
         throw new IOException("Took too long to split the" +
             " files and create the references, aborting split");
       }