hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ramkris...@apache.org
Subject git commit: HBASE-11815 - Flush and compaction could just close the tmp writer if there is an exception
Date Tue, 07 Oct 2014 04:14:11 GMT
Repository: hbase
Updated Branches:
  refs/heads/0.98 d5dfec42b -> 401996efd


HBASE-11815 - Flush and compaction could just close the tmp writer if
there is an exception


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/401996ef
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/401996ef
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/401996ef

Branch: refs/heads/0.98
Commit: 401996efdb60b0f3395eca2bd2f5215cd33346bb
Parents: d5dfec4
Author: Ramkrishna <ramkrishna.s.vasudevan@intel.com>
Authored: Tue Oct 7 09:43:35 2014 +0530
Committer: Ramkrishna <ramkrishna.s.vasudevan@intel.com>
Committed: Tue Oct 7 09:43:35 2014 +0530

----------------------------------------------------------------------
 .../hbase/regionserver/DefaultStoreFlusher.java    | 12 ++++++++++--
 .../regionserver/compactions/DefaultCompactor.java | 17 +++++++++++++----
 2 files changed, 23 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/401996ef/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/DefaultStoreFlusher.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/DefaultStoreFlusher.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/DefaultStoreFlusher.java
index b938faf..a13de99 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/DefaultStoreFlusher.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/DefaultStoreFlusher.java
@@ -31,7 +31,6 @@ import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.monitoring.MonitoredTask;
-import org.apache.hadoop.hbase.util.CollectionBackedScanner;
 import org.apache.hadoop.util.StringUtils;
 
 /**
@@ -71,10 +70,19 @@ public class DefaultStoreFlusher extends StoreFlusher {
         writer = store.createWriterInTmp(
             snapshot.size(), store.getFamily().getCompression(), false, true, true);
         writer.setTimeRangeTracker(snapshotTimeRangeTracker);
+        IOException e = null;
         try {
           flushed = performFlush(scanner, writer, smallestReadPoint);
+        } catch (IOException ioe) {
+          e = ioe;
+          // throw the exception out
+          throw ioe;
         } finally {
-          finalizeWriter(writer, cacheFlushId, status);
+          if (e != null) {
+            writer.close();
+          } else {
+            finalizeWriter(writer, cacheFlushId, status);
+          }
         }
       }
     } finally {

http://git-wip-us.apache.org/repos/asf/hbase/blob/401996ef/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/DefaultCompactor.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/DefaultCompactor.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/DefaultCompactor.java
index 857e2f2..e04a715 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/DefaultCompactor.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/DefaultCompactor.java
@@ -26,9 +26,9 @@ import java.util.List;
 import org.apache.hadoop.hbase.classification.InterfaceAudience;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.hbase.regionserver.Store;
 import org.apache.hadoop.hbase.regionserver.InternalScanner;
 import org.apache.hadoop.hbase.regionserver.ScanType;
+import org.apache.hadoop.hbase.regionserver.Store;
 import org.apache.hadoop.hbase.regionserver.StoreFile;
 import org.apache.hadoop.hbase.regionserver.StoreFileScanner;
 
@@ -54,6 +54,7 @@ public class DefaultCompactor extends Compactor {
 
     StoreFile.Writer writer = null;
     List<Path> newFiles = new ArrayList<Path>();
+    IOException e = null;
     try {
       InternalScanner scanner = null;
       try {
@@ -87,11 +88,19 @@ public class DefaultCompactor extends Compactor {
            scanner.close();
          }
       }
+    } catch (IOException ioe) {
+      e = ioe;
+      // Throw the exception;
+      throw ioe;
     } finally {
       if (writer != null) {
-        writer.appendMetadata(fd.maxSeqId, request.isMajor());
-        writer.close();
-        newFiles.add(writer.getPath());
+        if (e != null) {
+          writer.close();
+        } else {
+          writer.appendMetadata(fd.maxSeqId, request.isMajor());
+          writer.close();
+          newFiles.add(writer.getPath());
+        }
       }
     }
     return newFiles;


Mime
View raw message