You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ec...@apache.org on 2013/04/02 22:18:39 UTC

svn commit: r1463734 - in /accumulo/branches/1.5: fate/src/main/java/org/apache/accumulo/fate/ZooStore.java server/src/main/java/org/apache/accumulo/server/util/MetadataTable.java

Author: ecn
Date: Tue Apr  2 20:18:39 2013
New Revision: 1463734

URL: http://svn.apache.org/r1463734
Log:
ACCUMULO-1233 retry znode child scans

Modified:
    accumulo/branches/1.5/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java
    accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/util/MetadataTable.java

Modified: accumulo/branches/1.5/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java?rev=1463734&r1=1463733&r2=1463734&view=diff
==============================================================================
--- accumulo/branches/1.5/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java (original)
+++ accumulo/branches/1.5/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java Tue Apr  2 20:18:39 2013
@@ -250,16 +250,20 @@ public class ZooStore<T> implements TSto
   public Repo<T> top(long tid) {
     verifyReserved(tid);
     
-    try {
-      String txpath = getTXPath(tid);
-      String top = findTop(txpath);
-      if (top == null)
-        return null;
-      
-      byte[] ser = zk.getData(txpath + "/" + top, null);
-      return (Repo<T>) deserialize(ser);
-    } catch (Exception e) {
-      throw new RuntimeException(e);
+    while (true) {
+      try {
+        String txpath = getTXPath(tid);
+        String top = findTop(txpath);
+        if (top == null)
+          return null;
+        
+        byte[] ser = zk.getData(txpath + "/" + top, null);
+        return (Repo<T>) deserialize(ser);
+      } catch (KeeperException.NoNodeException ex) {
+        continue;
+      } catch (Exception e) {
+        throw new RuntimeException(e);
+      }
     }
   }
   

Modified: accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/util/MetadataTable.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/util/MetadataTable.java?rev=1463734&r1=1463733&r2=1463734&view=diff
==============================================================================
--- accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/util/MetadataTable.java (original)
+++ accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/util/MetadataTable.java Tue Apr  2 20:18:39 2013
@@ -892,10 +892,20 @@ public class MetadataTable extends org.a
   private static void getRootLogEntries(ArrayList<LogEntry> result) throws KeeperException, InterruptedException, IOException {
     IZooReaderWriter zoo = ZooReaderWriter.getInstance();
     String root = getZookeeperLogLocation();
-    for (String child : zoo.getChildren(root)) {
-      LogEntry e = new LogEntry();
-      e.fromBytes(zoo.getData(root + "/" + child, null));
-      result.add(e);
+    // there's a little race between getting the children and fetching 
+    // the data.  The log can be removed in between.
+    while (true) {
+      result.clear();
+      for (String child : zoo.getChildren(root)) {
+        LogEntry e = new LogEntry();
+        try {
+          e.fromBytes(zoo.getData(root + "/" + child, null));
+          result.add(e);
+        } catch (KeeperException.NoNodeException ex) {
+          continue;
+        }
+      }
+      break;
     }
   }