accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject [1/5] accumulo git commit: ACCUMULO-4008 remove the file if it fails to close cleanly
Date Tue, 22 Sep 2015 19:32:26 GMT
Repository: accumulo
Updated Branches:
  refs/heads/master 45f18c174 -> 0c4ae1596


ACCUMULO-4008 remove the file if it fails to close cleanly


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/3b9a89b5
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/3b9a89b5
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/3b9a89b5

Branch: refs/heads/master
Commit: 3b9a89b5fe7be1d4b2f6030a225cb6eb8d763f17
Parents: a541e76
Author: Eric C. Newton <eric.newton@gmail.com>
Authored: Tue Sep 22 13:45:06 2015 -0400
Committer: Eric C. Newton <eric.newton@gmail.com>
Committed: Tue Sep 22 13:45:06 2015 -0400

----------------------------------------------------------------------
 .../main/java/org/apache/accumulo/tserver/Compactor.java | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/3b9a89b5/server/tserver/src/main/java/org/apache/accumulo/tserver/Compactor.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/Compactor.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/Compactor.java
index 381f75c..b82d71b 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/Compactor.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/Compactor.java
@@ -366,7 +366,16 @@ public class Compactor implements Callable<CompactionStats> {
 
       FileSKVWriter mfwTmp = mfw;
       mfw = null; // set this to null so we do not try to close it again in finally if the
close fails
-      mfwTmp.close(); // if the close fails it will cause the compaction to fail
+      try {
+    	  mfwTmp.close(); // if the close fails it will cause the compaction to fail
+      } catch (IOException ex) {
+    	  if (!fs.deleteRecursively(outputFile.path())) {
+              if (fs.exists(outputFile.path())) {
+                log.error("Unable to delete " + outputFile);
+              }
+    	  }
+    	  throw ex;
+      }
 
       // Verify the file, since hadoop 0.20.2 sometimes lies about the success of close()
       try {


Mime
View raw message