accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1447829 - /accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/recovery/RecoverLease.java
Date Tue, 19 Feb 2013 17:21:07 GMT
Author: ecn
Date: Tue Feb 19 17:21:07 2013
New Revision: 1447829

URL: http://svn.apache.org/r1447829
Log:
ACCUMULO-1053 move lease recovery check to isReady()

Modified:
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/recovery/RecoverLease.java

Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/recovery/RecoverLease.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/recovery/RecoverLease.java?rev=1447829&r1=1447828&r2=1447829&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/recovery/RecoverLease.java
(original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/recovery/RecoverLease.java
Tue Feb 19 17:21:07 2013
@@ -20,7 +20,6 @@ import java.io.IOException;
 
 import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.conf.Property;
-import org.apache.accumulo.core.util.UtilWaitThread;
 import org.apache.accumulo.fate.Repo;
 import org.apache.accumulo.server.master.Master;
 import org.apache.accumulo.server.master.tableOps.MasterRepo;
@@ -67,14 +66,14 @@ public class RecoverLease extends Master
     if (diff < master.getSystemConfiguration().getTimeInMillis(Property.MASTER_RECOVERY_DELAY))
       return Math.max(diff, 0);
     FileSystem fs = master.getFileSystem();
-    if (fs.exists(getSource(master)))
-      return 0;
+    if (fs.exists(getSource(master))) {
+      return recoverLease(master);
+    }
     log.warn("Unable to locate file " + file + " wal for server " + server);
     return 1000;
   }
-
-  @Override
-  public Repo<Master> call(long tid, Master master) throws Exception {
+  
+  private long recoverLease(Master master) {
     Path source = getSource(master);
     FileSystem fs = master.getFileSystem();
     if (fs instanceof TraceFileSystem)
@@ -82,12 +81,12 @@ public class RecoverLease extends Master
     try {
       if (fs instanceof DistributedFileSystem) {
         DistributedFileSystem dfs = (DistributedFileSystem) fs;
-        while (!dfs.recoverLease(source)) {
+        if (!dfs.recoverLease(source)) {
           log.info("Waiting for file to be closed " + source.toString());
-          UtilWaitThread.sleep(1000);
+          return 1000;
         }
         log.info("Recovered lease on " + source.toString());
-        return new SubmitFileForRecovery(server, file);
+        return 0;
       }
     } catch (IOException ex) {
       log.error("error recovering lease ", ex);
@@ -95,13 +94,16 @@ public class RecoverLease extends Master
     try {
       fs.append(source).close();
       log.info("Recovered lease on " + source.toString() + " using append");
-      return new SubmitFileForRecovery(server, file);
+      return 0;
     } catch (IOException ex) {
       log.error("error recovering lease using append", ex);
-      RecoverLease result = new RecoverLease();
-      result.init(server, file);
-      return result;
+      return 1000;
     }
   }
+
+  @Override
+  public Repo<Master> call(long tid, Master master) throws Exception {
+    return new SubmitFileForRecovery(server, file);
+  }
   
 }



Mime
View raw message