accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1432219 - /accumulo/trunk/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java
Date Fri, 11 Jan 2013 18:38:48 GMT
Author: ecn
Date: Fri Jan 11 18:38:48 2013
New Revision: 1432219

URL: http://svn.apache.org/viewvc?rev=1432219&view=rev
Log:
ACCUMULO-919 refactor trash to use a local method with the semantics that match delete

Modified:
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java

Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java?rev=1432219&r1=1432218&r2=1432219&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java
(original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java
Fri Jan 11 18:38:48 2013
@@ -317,6 +317,16 @@ public class SimpleGarbageCollector impl
     }
   }
   
+  private boolean moveToTrash(Path path) throws IOException {
+    if (trash == null)
+      return false;
+    try {
+      return trash.moveToTrash(path);
+    } catch (FileNotFoundException ex) {
+      return false;
+    }
+  }
+  
   /*
    * this method removes deleted table dirs that are empty
    */
@@ -349,12 +359,8 @@ public class SimpleGarbageCollector impl
       
       if (tabletDirs.length == 0) {
         Path p = new Path(ServerConstants.getTablesDir() + "/" + delTableId);
-        try {
-          trash.moveToTrash(p);
-        } catch (FileNotFoundException ex) {
-          log.debug("Ignoring error moving a directory " + p + " to the trash", ex);
+        if (!moveToTrash(p)) 
           fs.delete(p, false);
-        }
       }
     }
   }
@@ -604,15 +610,8 @@ public class SimpleGarbageCollector impl
           try {
             
             Path p = new Path(ServerConstants.getTablesDir() + delete);
-            boolean moved = false;
-            if (trash != null)
-              try {
-                moved = trash.moveToTrash(p);
-              } catch (FileNotFoundException ex) {
-                log.debug("Ignoring exception moving " + p + " to trash");
-              }
             
-            if (moved || fs.delete(p, true)) {
+            if (moveToTrash(p) || fs.delete(p, true)) {
               // delete succeeded, still want to delete
               removeFlag = true;
               synchronized (SimpleGarbageCollector.this) {



Mime
View raw message