accumulo-commits mailing list archives

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

URL: http://svn.apache.org/viewvc?rev=1432173&view=rev
Log:
ACCUMULO-919 moveToTrash throws an exception if the file does not exists, which is different
than the way delete behaves

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=1432173&r1=1432172&r2=1432173&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 17:25:25 2013
@@ -16,6 +16,7 @@
  */
 package org.apache.accumulo.server.gc;
 
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.net.InetSocketAddress;
 import java.net.UnknownHostException;
@@ -346,8 +347,15 @@ public class SimpleGarbageCollector impl
       if (tabletDirs == null)
         continue;
       
-      if (tabletDirs.length == 0)
-        fs.delete(new Path(ServerConstants.getTablesDir() + "/" + delTableId), false);
+      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);
+          fs.delete(p, false);
+        }
+      }
     }
   }
   
@@ -596,8 +604,15 @@ 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 ((trash != null && trash.moveToTrash(p)) || fs.delete(p, true)) {
+            if (moved || fs.delete(p, true)) {
               // delete succeeded, still want to delete
               removeFlag = true;
               synchronized (SimpleGarbageCollector.this) {



Mime
View raw message