accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ktur...@apache.org
Subject [1/5] git commit: ACCUMULO-2428 throw exception when rename fails after compaction
Date Wed, 05 Mar 2014 23:05:25 GMT
Repository: accumulo
Updated Branches:
  refs/heads/1.6.0-SNAPSHOT 1392e07fb -> 80febfa6c


ACCUMULO-2428 throw exception when rename fails after compaction


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

Branch: refs/heads/1.6.0-SNAPSHOT
Commit: 4fd48fd2390cc3f4f2e76933833506ab26132c2c
Parents: 4cd12c4
Author: Keith Turner <kturner@apache.org>
Authored: Wed Mar 5 17:29:40 2014 -0500
Committer: Keith Turner <kturner@apache.org>
Committed: Wed Mar 5 17:29:40 2014 -0500

----------------------------------------------------------------------
 .../accumulo/server/tabletserver/Tablet.java    | 21 ++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/4fd48fd2/src/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java
----------------------------------------------------------------------
diff --git a/src/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java
b/src/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java
index 9bf4f96..2d01121 100644
--- a/src/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java
+++ b/src/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java
@@ -808,9 +808,7 @@ public class Tablet {
               fs.delete(newDatafile, true);
             }
             
-            if (!fs.rename(tmpDatafile, newDatafile)) {
-              throw new IOException("rename fails");
-            }
+            rename(fs, tmpDatafile, newDatafile);
           }
           break;
         } catch (IOException ioe) {
@@ -981,8 +979,7 @@ public class Tablet {
         
         // rename before putting in metadata table, so files in metadata table should
         // always exist
-        if (!fs.rename(tmpDatafile, newDatafile))
-          log.warn("Rename of " + tmpDatafile + " to " + newDatafile + " returned false");
+        rename(fs, tmpDatafile, newDatafile);
         
         if (dfv.getNumEntries() == 0) {
           fs.delete(newDatafile, true);
@@ -1018,7 +1015,7 @@ public class Tablet {
           String compactName = newDatafile.getName();
           
           for (Path path : oldDatafiles) {
-            fs.rename(path, new Path(location + "/delete+" + compactName + "+" + path.getName()));
+            rename(fs, path, new Path(location + "/delete+" + compactName + "+" + path.getName()));
           }
           
           if (fs.exists(newDatafile)) {
@@ -1026,8 +1023,7 @@ public class Tablet {
             throw new IllegalStateException("Target map file already exist " + newDatafile);
           }
           
-          if (!fs.rename(tmpDatafile, newDatafile))
-            log.warn("Rename of " + tmpDatafile + " to " + newDatafile + " returned false");
+          rename(fs, tmpDatafile, newDatafile);
           
           // start deleting files, if we do not finish they will be cleaned
           // up later
@@ -1561,8 +1557,7 @@ public class Tablet {
         filename = filename.split("\\+", 3)[2];
         path = location + "/" + filename;
         
-        if (!fs.rename(file.getPath(), new Path(path)))
-          log.warn("Rename of " + file.getPath().toString() + " to " + path + " returned
false");
+        rename(fs, file.getPath(), new Path(path));
       }
       
       if (filename.endsWith("_tmp")) {
@@ -3312,6 +3307,12 @@ public class Tablet {
     return smallestFiles;
   }
   
+  private static void rename(FileSystem fs, Path src, Path dst) throws IOException {
+    if (!fs.rename(src, dst)) {
+      throw new IOException("Rename " + src + " to " + dst + " returned false ");
+    }
+  }
+
   // END PRIVATE METHODS RELATED TO MAJOR COMPACTION
   
   /**


Mime
View raw message