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 11:05:42 UTC

svn commit: r1225152 - in /hbase/branches/0.92: 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 10:05:42 2011
New Revision: 1225152

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

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

Modified: hbase/branches/0.92/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/branches/0.92/CHANGES.txt?rev=1225152&r1=1225151&r2=1225152&view=diff
==============================================================================
--- hbase/branches/0.92/CHANGES.txt (original)
+++ hbase/branches/0.92/CHANGES.txt Wed Dec 28 10:05:42 2011
@@ -899,6 +899,7 @@ Release 0.90.6 - Unreleased
   BUG FIXES
    HBASE-4970  Add a parameter so that keepAliveTime of Htable thread pool can be changed (gaojinchao)
    HBASE-5060  HBase client is blocked forever (Jinchao)
+   HBASE-5009  Failure of creating split dir if it already exists prevents splits from happening further
 
 Release 0.90.5 - Unreleased
 

Modified: hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/io/Reference.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/io/Reference.java?rev=1225152&r1=1225151&r2=1225152&view=diff
==============================================================================
--- hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/io/Reference.java (original)
+++ hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/io/Reference.java Wed Dec 28 10:05:42 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.92/src/main/java/org/apache/hadoop/hbase/regionserver/SplitTransaction.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/regionserver/SplitTransaction.java?rev=1225152&r1=1225151&r2=1225152&view=diff
==============================================================================
--- hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/regionserver/SplitTransaction.java (original)
+++ hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/regionserver/SplitTransaction.java Wed Dec 28 10:05:42 2011
@@ -529,7 +529,14 @@ public 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);
   }
 
@@ -589,6 +596,10 @@ public 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");
       }