accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1455141 - /accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/master/CoordinateRecoveryTask.java
Date Mon, 11 Mar 2013 14:09:11 GMT
Author: ecn
Date: Mon Mar 11 14:09:11 2013
New Revision: 1455141

URL: http://svn.apache.org/r1455141
Log:
ACCUMULO-919: move recovery files to the trash, too

Modified:
    accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/master/CoordinateRecoveryTask.java

Modified: accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/master/CoordinateRecoveryTask.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/master/CoordinateRecoveryTask.java?rev=1455141&r1=1455140&r2=1455141&view=diff
==============================================================================
--- accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/master/CoordinateRecoveryTask.java
(original)
+++ accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/master/CoordinateRecoveryTask.java
Mon Mar 11 14:09:11 2013
@@ -16,6 +16,7 @@
  */
 package org.apache.accumulo.server.master;
 
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.net.URL;
 import java.net.URLClassLoader;
@@ -349,8 +350,7 @@ public class CoordinateRecoveryTask impl
       if (children != null) {
         for (FileStatus child : children) {
           log.info("Deleting recovery directory " + child);
-          if (!trash.moveToTrash(child.getPath()))
-            fs.delete(child.getPath(), true);
+          delete(child.getPath());
         }
       }
     } catch (IOException e) {
@@ -396,13 +396,21 @@ public class CoordinateRecoveryTask impl
     }
   }
   
+  private boolean delete(Path p) throws IOException {
+    try {
+      return trash.moveToTrash(p) || fs.delete(p, true);
+    } catch (FileNotFoundException ex) {
+      return false;
+    }
+  }
+  
   private void removeOldRecoverFiles() throws IOException {
     long now = System.currentTimeMillis();
     long maxAgeInMillis = ServerConfiguration.getSystemConfiguration().getTimeInMillis(Property.MASTER_RECOVERY_MAXAGE);
     FileStatus[] children = fs.listStatus(new Path(ServerConstants.getRecoveryDir()));
     if (children != null) {
       for (FileStatus child : children) {
-        if (now - child.getModificationTime() > maxAgeInMillis && !fs.delete(child.getPath(),
true)) {
+        if (now - child.getModificationTime() > maxAgeInMillis && !delete(child.getPath()))
{
           log.warn("Unable to delete old recovery directory: " + child.getPath());
         }
       }



Mime
View raw message