incubator-accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ktur...@apache.org
Subject svn commit: r1187617 - in /incubator/accumulo/trunk/src: core/src/main/java/org/apache/accumulo/core/zookeeper/ server/src/main/java/org/apache/accumulo/server/fate/ server/src/main/java/org/apache/accumulo/server/gc/ server/src/main/java/org/apache/ac...
Date Sat, 22 Oct 2011 01:13:08 GMT
Author: kturner
Date: Sat Oct 22 01:13:07 2011
New Revision: 1187617

URL: http://svn.apache.org/viewvc?rev=1187617&view=rev
Log:
ACCUMULO-9 Made accumulo more tolerant of all zookeepers being offline

Added:
    incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/zookeeper/IZooReader.java
    incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/zookeeper/IZooReaderWriter.java
Modified:
    incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/zookeeper/ZooReader.java
    incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/fate/ZooStore.java
    incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/gc/GarbageCollectWriteAheadLogs.java
    incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/logger/LogService.java
    incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java
    incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/Master.java
    incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/state/DeadServerList.java
    incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/state/ZooStore.java
    incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/state/tables/TableManager.java
    incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/tableOps/CompactRange.java
    incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/tableOps/RenameTable.java
    incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/tableOps/Utils.java
    incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/tserverOps/ShutdownTServer.java
    incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/problems/ProblemReports.java
    incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/security/ZKAuthenticator.java
    incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java
    incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
    incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/UniqueNameAllocator.java
    incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/functional/CacheTestClean.java
    incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/functional/CacheTestWriter.java
    incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/functional/SplitRecoveryTest.java
    incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/trace/TraceServer.java
    incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/upgrade/RunPreUpgradeCheck.java
    incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/upgrade/ZooKeeperUpgrade.java
    incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/util/ChangeSecret.java
    incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/util/CleanZookeeper.java
    incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/util/DeleteZooInstance.java
    incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/util/DumpZookeeper.java
    incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/util/Initialize.java
    incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/util/ListInstances.java
    incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/util/MetadataTable.java
    incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/util/TabletServerLocks.java
    incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/util/ZooZap.java
    incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/zookeeper/TransactionWatcher.java
    incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooLock.java
    incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooQueueLock.java
    incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooReaderWriter.java
    incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooReservation.java

Added: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/zookeeper/IZooReader.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/zookeeper/IZooReader.java?rev=1187617&view=auto
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/zookeeper/IZooReader.java (added)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/zookeeper/IZooReader.java Sat Oct 22 01:13:07 2011
@@ -0,0 +1,25 @@
+package org.apache.accumulo.core.zookeeper;
+
+import java.util.List;
+
+import org.apache.zookeeper.KeeperException;
+import org.apache.zookeeper.Watcher;
+import org.apache.zookeeper.data.Stat;
+
+public interface IZooReader {
+  
+  public abstract byte[] getData(String zPath, Stat stat) throws KeeperException, InterruptedException;
+  
+  public abstract Stat getStatus(String zPath) throws KeeperException, InterruptedException;
+  
+  public abstract Stat getStatus(String zPath, Watcher watcher) throws KeeperException, InterruptedException;
+  
+  public abstract List<String> getChildren(String zPath) throws KeeperException, InterruptedException;
+  
+  public abstract List<String> getChildren(String zPath, Watcher watcher) throws KeeperException, InterruptedException;
+  
+  public abstract boolean exists(String zPath) throws KeeperException, InterruptedException;
+  
+  public abstract boolean exists(String zPath, Watcher watcher) throws KeeperException, InterruptedException;
+  
+}
\ No newline at end of file

Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/zookeeper/ZooReader.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/zookeeper/ZooReader.java?rev=1187617&r1=1187616&r2=1187617&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/zookeeper/ZooReader.java (original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/zookeeper/ZooReader.java Sat Oct 22 01:13:07 2011
@@ -24,7 +24,7 @@ import org.apache.zookeeper.Watcher;
 import org.apache.zookeeper.ZooKeeper;
 import org.apache.zookeeper.data.Stat;
 
-public class ZooReader {
+public class ZooReader implements IZooReader {
   
   protected String keepers;
   protected int timeout;
@@ -37,30 +37,37 @@ public class ZooReader {
     return getSession(keepers, timeout, null);
   }
   
+  @Override
   public byte[] getData(String zPath, Stat stat) throws KeeperException, InterruptedException {
     return getZooKeeper().getData(zPath, false, stat);
   }
   
+  @Override
   public Stat getStatus(String zPath) throws KeeperException, InterruptedException {
     return getZooKeeper().exists(zPath, false);
   }
   
+  @Override
   public Stat getStatus(String zPath, Watcher watcher) throws KeeperException, InterruptedException {
     return getZooKeeper().exists(zPath, watcher);
   }
   
+  @Override
   public List<String> getChildren(String zPath) throws KeeperException, InterruptedException {
     return getZooKeeper().getChildren(zPath, false);
   }
   
+  @Override
   public List<String> getChildren(String zPath, Watcher watcher) throws KeeperException, InterruptedException {
     return getZooKeeper().getChildren(zPath, watcher);
   }
   
+  @Override
   public boolean exists(String zPath) throws KeeperException, InterruptedException {
     return getZooKeeper().exists(zPath, false) != null;
   }
   
+  @Override
   public boolean exists(String zPath, Watcher watcher) throws KeeperException, InterruptedException {
     return getZooKeeper().exists(zPath, watcher) != null;
   }

Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/fate/ZooStore.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/fate/ZooStore.java?rev=1187617&r1=1187616&r2=1187617&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/fate/ZooStore.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/fate/ZooStore.java Sat Oct 22 01:13:07 2011
@@ -34,7 +34,7 @@ import java.util.Set;
 
 import org.apache.accumulo.core.zookeeper.ZooUtil.NodeExistsPolicy;
 import org.apache.accumulo.core.zookeeper.ZooUtil.NodeMissingPolicy;
-import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
+import org.apache.accumulo.server.zookeeper.IZooReaderWriter;
 import org.apache.zookeeper.KeeperException;
 import org.apache.zookeeper.KeeperException.NoNodeException;
 import org.apache.zookeeper.KeeperException.NodeExistsException;
@@ -46,7 +46,7 @@ import org.apache.zookeeper.KeeperExcept
 public class ZooStore<T> implements TStore<T> {
   
   private String path;
-  private ZooReaderWriter zk;
+  private IZooReaderWriter zk;
   private Set<Long> reserved;
   private Map<Long,Long> defered;
   private SecureRandom idgenerator;
@@ -86,7 +86,7 @@ public class ZooStore<T> implements TSto
     return Long.parseLong(txdir.split("_")[1], 16);
   }
   
-  public ZooStore(String path, ZooReaderWriter zk) throws KeeperException, InterruptedException {
+  public ZooStore(String path, IZooReaderWriter zk) throws KeeperException, InterruptedException {
     
     this.path = path;
     this.zk = zk;

Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/gc/GarbageCollectWriteAheadLogs.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/gc/GarbageCollectWriteAheadLogs.java?rev=1187617&r1=1187616&r2=1187617&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/gc/GarbageCollectWriteAheadLogs.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/gc/GarbageCollectWriteAheadLogs.java Sat Oct 22 01:13:07 2011
@@ -42,6 +42,7 @@ import org.apache.accumulo.server.conf.S
 import org.apache.accumulo.server.security.SecurityConstants;
 import org.apache.accumulo.server.util.MetadataTable;
 import org.apache.accumulo.server.util.MetadataTable.LogEntry;
+import org.apache.accumulo.server.zookeeper.IZooReaderWriter;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
 import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
@@ -186,7 +187,7 @@ public class GarbageCollectWriteAheadLog
   
   private static int scanServers(Map<String,String> fileToServerMap) throws Exception {
     int count = 0;
-    ZooReaderWriter zk = ZooReaderWriter.getInstance();
+    IZooReaderWriter zk = ZooReaderWriter.getInstance();
     String loggersDir = ZooUtil.getRoot(HdfsZooInstance.getInstance()) + Constants.ZLOGGERS;
     List<String> servers = zk.getChildren(loggersDir, null);
     Collections.shuffle(servers);

Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/logger/LogService.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/logger/LogService.java?rev=1187617&r1=1187616&r2=1187617&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/logger/LogService.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/logger/LogService.java Sat Oct 22 01:13:07 2011
@@ -63,6 +63,7 @@ import org.apache.accumulo.server.util.F
 import org.apache.accumulo.server.util.Halt;
 import org.apache.accumulo.server.util.TServerUtils;
 import org.apache.accumulo.server.util.TServerUtils.ServerPort;
+import org.apache.accumulo.server.zookeeper.IZooReaderWriter;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
@@ -242,7 +243,7 @@ public class LogService implements Mutat
   
   void registerInZooKeeper(String zooDir) {
     try {
-      ZooReaderWriter zoo = ZooReaderWriter.getInstance();
+      IZooReaderWriter zoo = ZooReaderWriter.getInstance();
       String path = ZooUtil.getRoot(HdfsZooInstance.getInstance()) + zooDir;
       path += "/logger-";
       path = zoo.putEphemeralSequential(path, addressString.getBytes());

Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java?rev=1187617&r1=1187616&r2=1187617&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java Sat Oct 22 01:13:07 2011
@@ -299,7 +299,7 @@ public class LiveTServerSet implements W
     log.info("Removing zookeeper lock for " + server);
     String zpath = ZooUtil.getRoot(instance) + Constants.ZTSERVERS + "/" + server.hostPort();
     try {
-      ZooReaderWriter.getInstance().recursiveDelete(zpath, SKIP);
+      ZooReaderWriter.getRetryingInstance().recursiveDelete(zpath, SKIP);
     } catch (Exception e) {
       log.error("error removing tablet server lock", e);
     }

Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/Master.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/Master.java?rev=1187617&r1=1187616&r2=1187617&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/Master.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/Master.java Sat Oct 22 01:13:07 2011
@@ -148,6 +148,7 @@ import org.apache.accumulo.server.util.T
 import org.apache.accumulo.server.util.TablePropUtil;
 import org.apache.accumulo.server.util.TabletIterator.TabletDeletedException;
 import org.apache.accumulo.server.util.time.SimpleTimer;
+import org.apache.accumulo.server.zookeeper.IZooReaderWriter;
 import org.apache.accumulo.server.zookeeper.ZooLock;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
 import org.apache.accumulo.server.zookeeper.ZooLock.LockLossReason;
@@ -303,7 +304,7 @@ public class Master implements LiveTServ
   
   private void upgradeSettings() {
     AccumuloConfiguration conf = ServerConfiguration.getTableConfiguration(Constants.METADATA_TABLE_ID);
-    ZooReaderWriter zoo = ZooReaderWriter.getInstance();
+    IZooReaderWriter zoo = ZooReaderWriter.getInstance();
     if (!conf.getBoolean(Property.TABLE_BLOCKCACHE_ENABLED)) {
       try {
         // make sure the last shutdown was clean
@@ -540,7 +541,7 @@ public class Master implements LiveTServ
       
       String zTablePath = Constants.ZROOT + "/" + HdfsZooInstance.getInstance().getInstanceID() + Constants.ZTABLES + "/" + tableId + Constants.ZTABLE_FLUSH_ID;
       
-      ZooReaderWriter zoo = ZooReaderWriter.getInstance();
+      IZooReaderWriter zoo = ZooReaderWriter.getInstance();
       byte fid[];
       try {
         fid = zoo.mutate(zTablePath, null, null, new Mutator() {
@@ -1981,7 +1982,7 @@ public class Master implements LiveTServ
     // TODO: add shutdown for fate object
     try {
       fate = new Fate<Master>(this, new org.apache.accumulo.server.fate.ZooStore<Master>(ZooUtil.getRoot(instance) + Constants.ZFATE,
-          ZooReaderWriter.getInstance()), 4);
+          ZooReaderWriter.getRetryingInstance()), 4);
     } catch (KeeperException e) {
       throw new IOException(e);
     } catch (InterruptedException e) {

Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/state/DeadServerList.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/state/DeadServerList.java?rev=1187617&r1=1187616&r2=1187617&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/state/DeadServerList.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/state/DeadServerList.java Sat Oct 22 01:13:07 2011
@@ -22,6 +22,7 @@ import java.util.List;
 import org.apache.accumulo.core.master.thrift.DeadServer;
 import org.apache.accumulo.core.zookeeper.ZooUtil.NodeExistsPolicy;
 import org.apache.accumulo.core.zookeeper.ZooUtil.NodeMissingPolicy;
+import org.apache.accumulo.server.zookeeper.IZooReaderWriter;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
 import org.apache.log4j.Logger;
 import org.apache.zookeeper.data.Stat;
@@ -32,7 +33,7 @@ public class DeadServerList {
   
   public DeadServerList(String path) {
     this.path = path;
-    ZooReaderWriter zoo = ZooReaderWriter.getInstance();
+    IZooReaderWriter zoo = ZooReaderWriter.getInstance();
     try {
       zoo.mkdirs(path);
     } catch (Exception ex) {
@@ -42,7 +43,7 @@ public class DeadServerList {
   
   public List<DeadServer> getList() {
     List<DeadServer> result = new ArrayList<DeadServer>();
-    ZooReaderWriter zoo = ZooReaderWriter.getInstance();
+    IZooReaderWriter zoo = ZooReaderWriter.getInstance();
     try {
       List<String> children = zoo.getChildren(path);
       if (children != null) {
@@ -60,7 +61,7 @@ public class DeadServerList {
   }
   
   public void delete(String server) {
-    ZooReaderWriter zoo = ZooReaderWriter.getInstance();
+    IZooReaderWriter zoo = ZooReaderWriter.getInstance();
     try {
       zoo.recursiveDelete(path + "/" + server, NodeMissingPolicy.SKIP);
     } catch (Exception ex) {
@@ -69,7 +70,7 @@ public class DeadServerList {
   }
   
   public void post(String server, String cause) {
-    ZooReaderWriter zoo = ZooReaderWriter.getInstance();
+    IZooReaderWriter zoo = ZooReaderWriter.getInstance();
     try {
       zoo.putPersistentData(path + "/" + server, cause.getBytes(), NodeExistsPolicy.SKIP);
     } catch (Exception ex) {

Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/state/ZooStore.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/state/ZooStore.java?rev=1187617&r1=1187616&r2=1187617&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/state/ZooStore.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/state/ZooStore.java Sat Oct 22 01:13:07 2011
@@ -23,6 +23,7 @@ import org.apache.accumulo.core.zookeepe
 import org.apache.accumulo.core.zookeeper.ZooUtil.NodeExistsPolicy;
 import org.apache.accumulo.core.zookeeper.ZooUtil.NodeMissingPolicy;
 import org.apache.accumulo.server.client.HdfsZooInstance;
+import org.apache.accumulo.server.zookeeper.IZooReaderWriter;
 import org.apache.accumulo.server.zookeeper.ZooCache;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
 import org.apache.log4j.Logger;
@@ -83,7 +84,7 @@ public class ZooStore implements Distrib
     try {
       log.debug("Removing " + path);
       path = relative(path);
-      ZooReaderWriter zoo = ZooReaderWriter.getInstance();
+      IZooReaderWriter zoo = ZooReaderWriter.getInstance();
       if (zoo.exists(path)) zoo.recursiveDelete(path, NodeMissingPolicy.SKIP);
       cache.clear();
     } catch (Exception ex) {

Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/state/tables/TableManager.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/state/tables/TableManager.java?rev=1187617&r1=1187616&r2=1187617&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/state/tables/TableManager.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/state/tables/TableManager.java Sat Oct 22 01:13:07 2011
@@ -32,6 +32,7 @@ import org.apache.accumulo.core.zookeepe
 import org.apache.accumulo.core.zookeeper.ZooUtil.NodeMissingPolicy;
 import org.apache.accumulo.server.client.HdfsZooInstance;
 import org.apache.accumulo.server.util.TablePropUtil;
+import org.apache.accumulo.server.zookeeper.IZooReaderWriter;
 import org.apache.accumulo.server.zookeeper.ZooCache;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter.Mutator;
@@ -57,7 +58,7 @@ public class TableManager {
       throws KeeperException, InterruptedException {
     // state gets created last
     String zTablePath = Constants.ZROOT + "/" + instanceId + Constants.ZTABLES + "/" + tableId;
-    ZooReaderWriter zoo = ZooReaderWriter.getInstance();
+    IZooReaderWriter zoo = ZooReaderWriter.getInstance();
     zoo.putPersistentData(zTablePath, new byte[0], existsPolicy);
     zoo.putPersistentData(zTablePath + Constants.ZTABLE_CONF, new byte[0], existsPolicy);
     zoo.putPersistentData(zTablePath + Constants.ZTABLE_NAME, tableName.getBytes(), existsPolicy);

Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/tableOps/CompactRange.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/tableOps/CompactRange.java?rev=1187617&r1=1187616&r2=1187617&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/tableOps/CompactRange.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/tableOps/CompactRange.java Sat Oct 22 01:13:07 2011
@@ -43,6 +43,7 @@ import org.apache.accumulo.server.master
 import org.apache.accumulo.server.master.state.TServerInstance;
 import org.apache.accumulo.server.security.SecurityConstants;
 import org.apache.accumulo.server.util.MapCounter;
+import org.apache.accumulo.server.zookeeper.IZooReaderWriter;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter.Mutator;
 import org.apache.hadoop.io.Text;
@@ -190,7 +191,7 @@ public class CompactRange extends Master
   public Repo<Master> call(long tid, Master environment) throws Exception {
     String zTablePath = Constants.ZROOT + "/" + HdfsZooInstance.getInstance().getInstanceID() + Constants.ZTABLES + "/" + tableId + Constants.ZTABLE_COMPACT_ID;
     
-    ZooReaderWriter zoo = ZooReaderWriter.getInstance();
+    IZooReaderWriter zoo = ZooReaderWriter.getRetryingInstance();
     byte[] cid;
     try {
       cid = zoo.mutate(zTablePath, null, null, new Mutator() {

Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/tableOps/RenameTable.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/tableOps/RenameTable.java?rev=1187617&r1=1187616&r2=1187617&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/tableOps/RenameTable.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/tableOps/RenameTable.java Sat Oct 22 01:13:07 2011
@@ -26,6 +26,7 @@ import org.apache.accumulo.core.zookeepe
 import org.apache.accumulo.server.client.HdfsZooInstance;
 import org.apache.accumulo.server.fate.Repo;
 import org.apache.accumulo.server.master.Master;
+import org.apache.accumulo.server.zookeeper.IZooReaderWriter;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter.Mutator;
 import org.apache.log4j.Logger;
@@ -53,7 +54,7 @@ public class RenameTable extends MasterR
     
     Instance instance = HdfsZooInstance.getInstance();
     
-    ZooReaderWriter zoo = ZooReaderWriter.getInstance();
+    IZooReaderWriter zoo = ZooReaderWriter.getRetryingInstance();
     Utils.tableNameLock.lock();
     try {
       Utils.checkTableDoesNotExist(instance, newTableName, tableId, TableOperation.RENAME);

Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/tableOps/Utils.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/tableOps/Utils.java?rev=1187617&r1=1187616&r2=1187617&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/tableOps/Utils.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/tableOps/Utils.java Sat Oct 22 01:13:07 2011
@@ -29,6 +29,7 @@ import org.apache.accumulo.core.client.i
 import org.apache.accumulo.core.zookeeper.ZooUtil;
 import org.apache.accumulo.server.client.HdfsZooInstance;
 import org.apache.accumulo.server.zookeeper.DistributedReadWriteLock;
+import org.apache.accumulo.server.zookeeper.IZooReaderWriter;
 import org.apache.accumulo.server.zookeeper.ZooQueueLock;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
 import org.apache.accumulo.server.zookeeper.ZooReservation;
@@ -50,7 +51,7 @@ public class Utils {
     
     String tableId = null;
     try {
-      ZooReaderWriter zoo = ZooReaderWriter.getInstance();
+      IZooReaderWriter zoo = ZooReaderWriter.getRetryingInstance();
       final String ntp = ZooUtil.getRoot(instance) + Constants.ZTABLES;
       byte[] nid = zoo.mutate(ntp, "0".getBytes(), ZooUtil.PUBLIC, new Mutator() {
         @Override
@@ -75,7 +76,7 @@ public class Utils {
     if (getLock(tableId, tid, writeLock).tryLock()) {
       if (tableMustExist) {
         Instance instance = HdfsZooInstance.getInstance();
-        ZooReaderWriter zk = ZooReaderWriter.getInstance();
+        IZooReaderWriter zk = ZooReaderWriter.getRetryingInstance();
         if (!zk.exists(ZooUtil.getRoot(instance) + Constants.ZTABLES + "/" + tableId)) throw new ThriftTableOperationException(tableId, "", op,
             TableOperationExceptionType.NOTFOUND, "Table does not exists");
       }
@@ -94,7 +95,7 @@ public class Utils {
     
     String resvPath = ZooUtil.getRoot(instance) + Constants.ZHDFS_RESERVATIONS + "/" + new String(Base64.encodeBase64(directory.getBytes()));
     
-    ZooReaderWriter zk = ZooReaderWriter.getInstance();
+    IZooReaderWriter zk = ZooReaderWriter.getRetryingInstance();
     
     if (ZooReservation.attempt(zk, resvPath, String.format("%016x", tid), "")) {
       return 0;
@@ -104,7 +105,7 @@ public class Utils {
   public static void unreserveHdfsDirectory(String directory, long tid) throws KeeperException, InterruptedException {
     Instance instance = HdfsZooInstance.getInstance();
     String resvPath = ZooUtil.getRoot(instance) + Constants.ZHDFS_RESERVATIONS + "/" + new String(Base64.encodeBase64(directory.getBytes()));
-    ZooReservation.release(ZooReaderWriter.getInstance(), resvPath, String.format("%016x", tid));
+    ZooReservation.release(ZooReaderWriter.getRetryingInstance(), resvPath, String.format("%016x", tid));
   }
   
   private static Lock getLock(String tableId, long tid, boolean writeLock) throws Exception {

Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/tserverOps/ShutdownTServer.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/tserverOps/ShutdownTServer.java?rev=1187617&r1=1187616&r2=1187617&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/tserverOps/ShutdownTServer.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/master/tserverOps/ShutdownTServer.java Sat Oct 22 01:13:07 2011
@@ -27,6 +27,7 @@ import org.apache.accumulo.server.master
 import org.apache.accumulo.server.master.LiveTServerSet.TServerConnection;
 import org.apache.accumulo.server.master.state.TServerInstance;
 import org.apache.accumulo.server.master.tableOps.MasterRepo;
+import org.apache.accumulo.server.zookeeper.IZooReaderWriter;
 import org.apache.accumulo.server.zookeeper.ZooLock;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
 import org.apache.log4j.Logger;
@@ -57,7 +58,7 @@ public class ShutdownTServer extends Mas
       String path = ZooUtil.getRoot(m.getInstance()) + Constants.ZTSERVERS + "/" + tserver;
       ZooLock.deleteLock(path);
       path = ZooUtil.getRoot(m.getInstance()) + Constants.ZDEADTSERVERS + "/" + tserver;
-      ZooReaderWriter zoo = ZooReaderWriter.getInstance();
+      IZooReaderWriter zoo = ZooReaderWriter.getInstance();
       zoo.putPersistentData(path, "forced down".getBytes(), NodeExistsPolicy.OVERWRITE);
       return new DisconnectLogger(server.getLocation().getAddress().getHostAddress());
     }

Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/problems/ProblemReports.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/problems/ProblemReports.java?rev=1187617&r1=1187616&r2=1187617&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/problems/ProblemReports.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/problems/ProblemReports.java Sat Oct 22 01:13:07 2011
@@ -45,6 +45,7 @@ import org.apache.accumulo.server.client
 import org.apache.accumulo.server.security.SecurityConstants;
 import org.apache.accumulo.server.util.MetadataTable;
 import org.apache.accumulo.server.util.NamingThreadFactory;
+import org.apache.accumulo.server.zookeeper.IZooReaderWriter;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
 import org.apache.commons.collections.map.LRUMap;
 import org.apache.hadoop.io.Text;
@@ -177,7 +178,7 @@ public class ProblemReports implements I
       
       return new Iterator<ProblemReport>() {
         
-        ZooReaderWriter zoo = ZooReaderWriter.getInstance();
+        IZooReaderWriter zoo = ZooReaderWriter.getInstance();
         private int iter1Count = 0;
         private Iterator<String> iter1;
         

Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/security/ZKAuthenticator.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/security/ZKAuthenticator.java?rev=1187617&r1=1187616&r2=1187617&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/security/ZKAuthenticator.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/security/ZKAuthenticator.java Sat Oct 22 01:13:07 2011
@@ -45,6 +45,7 @@ import org.apache.accumulo.core.util.Byt
 import org.apache.accumulo.core.zookeeper.ZooUtil.NodeExistsPolicy;
 import org.apache.accumulo.core.zookeeper.ZooUtil.NodeMissingPolicy;
 import org.apache.accumulo.server.client.HdfsZooInstance;
+import org.apache.accumulo.server.zookeeper.IZooReaderWriter;
 import org.apache.accumulo.server.zookeeper.ZooCache;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
 import org.apache.log4j.Logger;
@@ -110,7 +111,7 @@ public final class ZKAuthenticator imple
     
     try {
       // remove old settings from zookeeper first, if any
-      ZooReaderWriter zoo = ZooReaderWriter.getInstance();
+      IZooReaderWriter zoo = ZooReaderWriter.getRetryingInstance();
       synchronized (zooCache) {
         zooCache.clear();
         if (zoo.exists(ZKUserPath)) {
@@ -150,7 +151,7 @@ public final class ZKAuthenticator imple
       throws KeeperException, InterruptedException {
     synchronized (zooCache) {
       zooCache.clear();
-      ZooReaderWriter zoo = ZooReaderWriter.getInstance();
+      IZooReaderWriter zoo = ZooReaderWriter.getRetryingInstance();
       zoo.putPrivatePersistentData(ZKUserPath + "/" + user, pass, NodeExistsPolicy.FAIL);
       zoo.putPersistentData(ZKUserPath + "/" + user + ZKUserAuths, Tool.convertAuthorizations(auths), NodeExistsPolicy.FAIL);
       zoo.putPersistentData(ZKUserPath + "/" + user + ZKUserSysPerms, Tool.convertSystemPermissions(sysPerms), NodeExistsPolicy.FAIL);
@@ -166,7 +167,7 @@ public final class ZKAuthenticator imple
   private void createTablePerm(String user, String table, Set<TablePermission> perms) throws KeeperException, InterruptedException {
     synchronized (zooCache) {
       zooCache.clear();
-      ZooReaderWriter.getInstance().putPersistentData(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table, Tool.convertTablePermissions(perms),
+      ZooReaderWriter.getRetryingInstance().putPersistentData(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table, Tool.convertTablePermissions(perms),
           NodeExistsPolicy.FAIL);
     }
   }
@@ -232,7 +233,7 @@ public final class ZKAuthenticator imple
     try {
       synchronized (zooCache) {
         zooCache.clear();
-        ZooReaderWriter.getInstance().recursiveDelete(ZKUserPath + "/" + user, NodeMissingPolicy.FAIL);
+        ZooReaderWriter.getRetryingInstance().recursiveDelete(ZKUserPath + "/" + user, NodeMissingPolicy.FAIL);
       }
       log.info("Deleted user " + user + " at the request of user " + credentials.user);
     } catch (InterruptedException e) {
@@ -256,7 +257,7 @@ public final class ZKAuthenticator imple
       try {
         synchronized (zooCache) {
           zooCache.clear();
-          ZooReaderWriter.getInstance().putPrivatePersistentData(ZKUserPath + "/" + user, Tool.createPass(pass), NodeExistsPolicy.OVERWRITE);
+          ZooReaderWriter.getRetryingInstance().putPrivatePersistentData(ZKUserPath + "/" + user, Tool.createPass(pass), NodeExistsPolicy.OVERWRITE);
         }
         log.info("Changed password for user " + user + " at the request of user " + credentials.user);
       } catch (KeeperException e) {
@@ -292,7 +293,7 @@ public final class ZKAuthenticator imple
       try {
         synchronized (zooCache) {
           zooCache.clear();
-          ZooReaderWriter.getInstance().putPersistentData(ZKUserPath + "/" + user + ZKUserAuths, Tool.convertAuthorizations(authorizations),
+          ZooReaderWriter.getRetryingInstance().putPersistentData(ZKUserPath + "/" + user + ZKUserAuths, Tool.convertAuthorizations(authorizations),
               NodeExistsPolicy.OVERWRITE);
         }
         log.info("Changed authorizations for user " + user + " at the request of user " + credentials.user);
@@ -396,7 +397,7 @@ public final class ZKAuthenticator imple
         if (perms.add(permission)) {
           synchronized (zooCache) {
             zooCache.clear();
-            ZooReaderWriter.getInstance().putPersistentData(ZKUserPath + "/" + user + ZKUserSysPerms, Tool.convertSystemPermissions(perms),
+            ZooReaderWriter.getRetryingInstance().putPersistentData(ZKUserPath + "/" + user + ZKUserSysPerms, Tool.convertSystemPermissions(perms),
                 NodeExistsPolicy.OVERWRITE);
           }
         }
@@ -430,7 +431,7 @@ public final class ZKAuthenticator imple
         if (tablePerms.add(permission)) {
           synchronized (zooCache) {
             zooCache.clear();
-            ZooReaderWriter.getInstance().putPersistentData(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table, Tool.convertTablePermissions(tablePerms),
+            ZooReaderWriter.getRetryingInstance().putPersistentData(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table, Tool.convertTablePermissions(tablePerms),
                 NodeExistsPolicy.OVERWRITE);
           }
         }
@@ -462,7 +463,7 @@ public final class ZKAuthenticator imple
         if (sysPerms.remove(permission)) {
           synchronized (zooCache) {
             zooCache.clear();
-            ZooReaderWriter.getInstance().putPersistentData(ZKUserPath + "/" + user + ZKUserSysPerms, Tool.convertSystemPermissions(sysPerms),
+            ZooReaderWriter.getRetryingInstance().putPersistentData(ZKUserPath + "/" + user + ZKUserSysPerms, Tool.convertSystemPermissions(sysPerms),
                 NodeExistsPolicy.OVERWRITE);
           }
         }
@@ -494,7 +495,7 @@ public final class ZKAuthenticator imple
       try {
         if (tablePerms.remove(permission)) {
           zooCache.clear();
-          ZooReaderWriter zoo = ZooReaderWriter.getInstance();
+          IZooReaderWriter zoo = ZooReaderWriter.getRetryingInstance();
           if (tablePerms.size() == 0) zoo.recursiveDelete(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table, NodeMissingPolicy.SKIP);
           else zoo.putPersistentData(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table, Tool.convertTablePermissions(tablePerms),
               NodeExistsPolicy.OVERWRITE);
@@ -519,7 +520,7 @@ public final class ZKAuthenticator imple
     try {
       synchronized (zooCache) {
         zooCache.clear();
-        ZooReaderWriter zoo = ZooReaderWriter.getInstance();
+        IZooReaderWriter zoo = ZooReaderWriter.getRetryingInstance();
         for (String user : zooCache.getChildren(ZKUserPath))
           zoo.recursiveDelete(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table, NodeMissingPolicy.SKIP);
       }

Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java?rev=1187617&r1=1187616&r2=1187617&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java Sat Oct 22 01:13:07 2011
@@ -113,6 +113,7 @@ import org.apache.accumulo.server.util.M
 import org.apache.accumulo.server.util.MetadataTable;
 import org.apache.accumulo.server.util.TabletOperations;
 import org.apache.accumulo.server.util.MetadataTable.LogEntry;
+import org.apache.accumulo.server.zookeeper.IZooReaderWriter;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileStatus;
@@ -744,7 +745,7 @@ public class Tablet {
     
     void bringMinorCompactionOnline(Path tmpDatafile, Path newDatafile, Path absMergeFile, DataFileValue dfv, CommitSession commitSession, long flushId) {
       
-      ZooReaderWriter zoo = ZooReaderWriter.getInstance();
+      IZooReaderWriter zoo = ZooReaderWriter.getInstance();
       if (extent.equals(Constants.ROOT_TABLET_EXTENT)) {
         try {
           if (!zoo.isLockHeld(tabletServer.getLock().getLockID())) {
@@ -942,7 +943,7 @@ public class Tablet {
         
         t1 = System.currentTimeMillis();
         
-        ZooReaderWriter zoo = ZooReaderWriter.getInstance();
+        IZooReaderWriter zoo = ZooReaderWriter.getInstance();
         
         dataSourceDeletions.incrementAndGet();
         
@@ -2256,7 +2257,7 @@ public class Tablet {
     try {
       String zTablePath = Constants.ZROOT + "/" + HdfsZooInstance.getInstance().getInstanceID() + Constants.ZTABLES + "/" + extent.getTableId()
           + Constants.ZTABLE_FLUSH_ID;
-      return Long.parseLong(new String(ZooReaderWriter.getInstance().getData(zTablePath, null)));
+      return Long.parseLong(new String(ZooReaderWriter.getRetryingInstance().getData(zTablePath, null)));
     } catch (Exception e) {
       throw new RuntimeException(e);
     }
@@ -2266,7 +2267,7 @@ public class Tablet {
     try {
       String zTablePath = Constants.ZROOT + "/" + HdfsZooInstance.getInstance().getInstanceID() + Constants.ZTABLES + "/" + extent.getTableId()
           + Constants.ZTABLE_COMPACT_ID;
-      return Long.parseLong(new String(ZooReaderWriter.getInstance().getData(zTablePath, null)));
+      return Long.parseLong(new String(ZooReaderWriter.getRetryingInstance().getData(zTablePath, null)));
     } catch (Exception e) {
       throw new RuntimeException(e);
     }

Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java?rev=1187617&r1=1187616&r2=1187617&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java Sat Oct 22 01:13:07 2011
@@ -175,6 +175,7 @@ import org.apache.accumulo.server.util.M
 import org.apache.accumulo.server.util.TServerUtils.ServerPort;
 import org.apache.accumulo.server.util.time.RelativeTime;
 import org.apache.accumulo.server.util.time.SimpleTimer;
+import org.apache.accumulo.server.zookeeper.IZooReaderWriter;
 import org.apache.accumulo.server.zookeeper.TransactionWatcher;
 import org.apache.accumulo.server.zookeeper.ZooCache;
 import org.apache.accumulo.server.zookeeper.ZooLock;
@@ -2525,7 +2526,7 @@ public class TabletServer extends Abstra
   }
   
   private void announceExistence() {
-    ZooReaderWriter zoo = ZooReaderWriter.getInstance();
+    IZooReaderWriter zoo = ZooReaderWriter.getInstance();
     try {
       String zPath = ZooUtil.getRoot(HdfsZooInstance.getInstance()) + Constants.ZTSERVERS + "/" + getClientAddressString();
       

Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/UniqueNameAllocator.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/UniqueNameAllocator.java?rev=1187617&r1=1187616&r2=1187617&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/UniqueNameAllocator.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/UniqueNameAllocator.java Sat Oct 22 01:13:07 2011
@@ -48,7 +48,7 @@ public class UniqueNameAllocator {
       final int allocate = 100 + rand.nextInt(100);
       
       try {
-        byte[] max = ZooReaderWriter.getInstance().mutate(nextNamePath, null, ZooUtil.PRIVATE, new ZooReaderWriter.Mutator() {
+        byte[] max = ZooReaderWriter.getRetryingInstance().mutate(nextNamePath, null, ZooUtil.PRIVATE, new ZooReaderWriter.Mutator() {
           public byte[] mutate(byte[] currentValue) throws Exception {
             long l = Long.parseLong(new String(currentValue), Character.MAX_RADIX);
             l += allocate;

Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/functional/CacheTestClean.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/functional/CacheTestClean.java?rev=1187617&r1=1187616&r2=1187617&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/functional/CacheTestClean.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/functional/CacheTestClean.java Sat Oct 22 01:13:07 2011
@@ -19,6 +19,7 @@ package org.apache.accumulo.server.test.
 import java.io.File;
 
 import org.apache.accumulo.core.zookeeper.ZooUtil.NodeMissingPolicy;
+import org.apache.accumulo.server.zookeeper.IZooReaderWriter;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
 
 public class CacheTestClean {
@@ -30,7 +31,7 @@ public class CacheTestClean {
     String rootDir = args[0];
     File reportDir = new File(args[1]);
     
-    ZooReaderWriter zoo = ZooReaderWriter.getInstance();
+    IZooReaderWriter zoo = ZooReaderWriter.getInstance();
     
     if (zoo.exists(rootDir)) {
       zoo.recursiveDelete(rootDir, NodeMissingPolicy.FAIL);

Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/functional/CacheTestWriter.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/functional/CacheTestWriter.java?rev=1187617&r1=1187616&r2=1187617&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/functional/CacheTestWriter.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/functional/CacheTestWriter.java Sat Oct 22 01:13:07 2011
@@ -29,6 +29,7 @@ import java.util.UUID;
 import org.apache.accumulo.core.util.UtilWaitThread;
 import org.apache.accumulo.core.zookeeper.ZooUtil.NodeExistsPolicy;
 import org.apache.accumulo.core.zookeeper.ZooUtil.NodeMissingPolicy;
+import org.apache.accumulo.server.zookeeper.IZooReaderWriter;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
 
 public class CacheTestWriter {
@@ -36,7 +37,7 @@ public class CacheTestWriter {
   static final int NUM_DATA = 3;
   
   public static void main(String[] args) throws Exception {
-    ZooReaderWriter zk = ZooReaderWriter.getInstance();
+    IZooReaderWriter zk = ZooReaderWriter.getInstance();
     
     String rootDir = args[0];
     File reportDir = new File(args[1]);

Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/functional/SplitRecoveryTest.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/functional/SplitRecoveryTest.java?rev=1187617&r1=1187616&r2=1187617&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/functional/SplitRecoveryTest.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/functional/SplitRecoveryTest.java Sat Oct 22 01:13:07 2011
@@ -46,6 +46,7 @@ import org.apache.accumulo.server.securi
 import org.apache.accumulo.server.tabletserver.TabletServer;
 import org.apache.accumulo.server.tabletserver.TabletTime;
 import org.apache.accumulo.server.util.MetadataTable;
+import org.apache.accumulo.server.zookeeper.IZooReaderWriter;
 import org.apache.accumulo.server.zookeeper.ZooLock;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
 import org.apache.accumulo.server.zookeeper.ZooLock.LockLossReason;
@@ -76,7 +77,7 @@ public class SplitRecoveryTest extends F
   @Override
   public void run() throws Exception {
     String zPath = ZooUtil.getRoot(HdfsZooInstance.getInstance()) + "/testLock";
-    ZooReaderWriter zoo = ZooReaderWriter.getInstance();
+    IZooReaderWriter zoo = ZooReaderWriter.getInstance();
     zoo.putPersistentData(zPath, "".getBytes(), NodeExistsPolicy.OVERWRITE);
     ZooLock zl = new ZooLock(zPath);
     boolean gotLock = zl.tryLock(new LockWatcher() {

Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/trace/TraceServer.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/trace/TraceServer.java?rev=1187617&r1=1187616&r2=1187617&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/trace/TraceServer.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/trace/TraceServer.java Sat Oct 22 01:13:07 2011
@@ -36,6 +36,7 @@ import org.apache.accumulo.server.Accumu
 import org.apache.accumulo.server.client.HdfsZooInstance;
 import org.apache.accumulo.server.conf.ServerConfiguration;
 import org.apache.accumulo.server.util.time.SimpleTimer;
+import org.apache.accumulo.server.zookeeper.IZooReaderWriter;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
 import org.apache.hadoop.io.Text;
 import org.apache.log4j.Logger;
@@ -185,7 +186,7 @@ public class TraceServer implements Watc
   
   private void registerInZooKeeper(String name) throws Exception {
     String root = ZooUtil.getRoot(HdfsZooInstance.getInstance()) + Constants.ZTRACERS;
-    ZooReaderWriter zoo = ZooReaderWriter.getInstance();
+    IZooReaderWriter zoo = ZooReaderWriter.getInstance();
     String path = zoo.putEphemeralSequential(root + "/trace-", name.getBytes());
     zoo.exists(path, this);
   }

Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/upgrade/RunPreUpgradeCheck.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/upgrade/RunPreUpgradeCheck.java?rev=1187617&r1=1187616&r2=1187617&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/upgrade/RunPreUpgradeCheck.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/upgrade/RunPreUpgradeCheck.java Sat Oct 22 01:13:07 2011
@@ -30,6 +30,7 @@ import org.apache.accumulo.core.iterator
 import org.apache.accumulo.core.util.CachedConfiguration;
 import org.apache.accumulo.server.ServerConstants;
 import org.apache.accumulo.server.client.HdfsZooInstance;
+import org.apache.accumulo.server.zookeeper.IZooReaderWriter;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileStatus;
@@ -55,7 +56,7 @@ public class RunPreUpgradeCheck {
     }
     
     String rootTabletWALOGS = ZROOT_PATH + "/" + HdfsZooInstance.getInstance().getInstanceID() + ZLOGS_PATH;
-    ZooReaderWriter session = ZooReaderWriter.getInstance();
+    IZooReaderWriter session = ZooReaderWriter.getInstance();
     
     if (session.exists(rootTabletWALOGS) && session.getChildren(rootTabletWALOGS).size() != 0) {
       System.err.println("The root tablet has write ahead logs");

Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/upgrade/ZooKeeperUpgrade.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/upgrade/ZooKeeperUpgrade.java?rev=1187617&r1=1187616&r2=1187617&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/upgrade/ZooKeeperUpgrade.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/upgrade/ZooKeeperUpgrade.java Sat Oct 22 01:13:07 2011
@@ -35,6 +35,7 @@ import org.apache.accumulo.server.Server
 import org.apache.accumulo.server.client.HdfsZooInstance;
 import org.apache.accumulo.server.master.state.tables.TableManager;
 import org.apache.accumulo.server.util.Initialize;
+import org.apache.accumulo.server.zookeeper.IZooReaderWriter;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileStatus;
@@ -54,7 +55,7 @@ public class ZooKeeperUpgrade extends In
   private static String zkInstanceRoot;
   
   public static void main(String[] args) {
-    ZooReaderWriter zoo = ZooReaderWriter.getInstance();
+    IZooReaderWriter zoo = ZooReaderWriter.getInstance();
     try {
       zkInstanceRoot = ZooUtil.getRoot(HdfsZooInstance.getInstance());
       upgradeZooKeeper(zoo);
@@ -65,7 +66,7 @@ public class ZooKeeperUpgrade extends In
     }
   }
   
-  static void upgradeSecurity(ZooReaderWriter zoo) throws Exception {
+  static void upgradeSecurity(IZooReaderWriter zoo) throws Exception {
     
     SortedMap<String,String> tableIds = Tables.getNameToIdMap(HdfsZooInstance.getInstance());
     
@@ -91,7 +92,7 @@ public class ZooKeeperUpgrade extends In
     
   }
   
-  static void upgradeZooKeeper(ZooReaderWriter zoo) throws IOException, KeeperException, InterruptedException {
+  static void upgradeZooKeeper(IZooReaderWriter zoo) throws IOException, KeeperException, InterruptedException {
     SortedSet<String> tableNames = getOldTableNames(zoo);
     
     // initialize zookeeper layout (skip 1.1 dirs that may already be there)
@@ -143,7 +144,7 @@ public class ZooKeeperUpgrade extends In
     zoo.recursiveDelete(zkInstanceRoot + OLD_CONF_DIR, NodeMissingPolicy.SKIP);
   }
   
-  private static SortedSet<String> getOldTableNames(ZooReaderWriter zoo) throws IOException, KeeperException, InterruptedException {
+  private static SortedSet<String> getOldTableNames(IZooReaderWriter zoo) throws IOException, KeeperException, InterruptedException {
     SortedSet<String> tableNames = new TreeSet<String>();
     // get list of 1.1 tables from HDFS and ZooKeeper
     FileStatus[] tablesStatus = FileSystem.get(new Configuration()).listStatus(new Path(ServerConstants.getTablesDir()));
@@ -156,14 +157,14 @@ public class ZooKeeperUpgrade extends In
     return tableNames;
   }
   
-  private static void move(ZooReaderWriter zoo, String source, String destination) throws KeeperException, InterruptedException {
+  private static void move(IZooReaderWriter zoo, String source, String destination) throws KeeperException, InterruptedException {
     if (zoo.exists(source)) {
       zoo.recursiveCopyPersistent(source, destination, NodeExistsPolicy.FAIL);
       zoo.recursiveDelete(source, NodeMissingPolicy.SKIP);
     }
   }
   
-  private static void validateConfig(String tableId, ZooReaderWriter zoo) throws KeeperException, InterruptedException {
+  private static void validateConfig(String tableId, IZooReaderWriter zoo) throws KeeperException, InterruptedException {
     String confPath = zkInstanceRoot + Constants.ZTABLES + "/" + tableId + Constants.ZTABLE_CONF;
     for (String propKey : zoo.getChildren(confPath)) {
       String propKeyPath = confPath + "/" + propKey;

Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/util/ChangeSecret.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/util/ChangeSecret.java?rev=1187617&r1=1187616&r2=1187617&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/util/ChangeSecret.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/util/ChangeSecret.java Sat Oct 22 01:13:07 2011
@@ -29,6 +29,7 @@ import org.apache.accumulo.core.zookeepe
 import org.apache.accumulo.core.zookeeper.ZooUtil.NodeMissingPolicy;
 import org.apache.accumulo.server.ServerConstants;
 import org.apache.accumulo.server.client.HdfsZooInstance;
+import org.apache.accumulo.server.zookeeper.IZooReaderWriter;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
@@ -98,7 +99,7 @@ public class ChangeSecret {
   
   private static String rewriteZooKeeperInstance(final Instance inst, String oldPass, String newPass) throws Exception {
     final ZooReaderWriter orig = new ZooReaderWriter(inst.getZooKeepers(), inst.getZooKeepersSessionTimeOut(), oldPass);
-    final ZooReaderWriter new_ = new ZooReaderWriter(inst.getZooKeepers(), inst.getZooKeepersSessionTimeOut(), newPass);
+    final IZooReaderWriter new_ = new ZooReaderWriter(inst.getZooKeepers(), inst.getZooKeepersSessionTimeOut(), newPass);
     final String newInstanceId = UUID.randomUUID().toString();
     String root = ZooUtil.getRoot(inst);
     recurse(orig, root, new Visitor() {
@@ -138,7 +139,7 @@ public class ChangeSecret {
   }
   
   private static void deleteInstance(Instance origInstance, String oldPass) throws Exception {
-    ZooReaderWriter orig = new ZooReaderWriter(origInstance.getZooKeepers(), origInstance.getZooKeepersSessionTimeOut(), oldPass);
+    IZooReaderWriter orig = new ZooReaderWriter(origInstance.getZooKeepers(), origInstance.getZooKeepersSessionTimeOut(), oldPass);
     orig.recursiveDelete("/accumulo/" + origInstance.getInstanceID(), NodeMissingPolicy.SKIP);
   }
 }

Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/util/CleanZookeeper.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/util/CleanZookeeper.java?rev=1187617&r1=1187616&r2=1187617&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/util/CleanZookeeper.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/util/CleanZookeeper.java Sat Oct 22 01:13:07 2011
@@ -21,6 +21,7 @@ import java.io.IOException;
 import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.zookeeper.ZooUtil.NodeMissingPolicy;
 import org.apache.accumulo.server.client.HdfsZooInstance;
+import org.apache.accumulo.server.zookeeper.IZooReaderWriter;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
 import org.apache.log4j.Logger;
 import org.apache.zookeeper.KeeperException;
@@ -42,7 +43,7 @@ public class CleanZookeeper {
       System.exit(1);
     }
     String root = Constants.ZROOT;
-    ZooReaderWriter zk = ZooReaderWriter.getInstance();
+    IZooReaderWriter zk = ZooReaderWriter.getInstance();
     if (args.length == 2) {
       zk.getZooKeeper().addAuthInfo("digest", args[1].getBytes());
     }

Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/util/DeleteZooInstance.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/util/DeleteZooInstance.java?rev=1187617&r1=1187616&r2=1187617&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/util/DeleteZooInstance.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/util/DeleteZooInstance.java Sat Oct 22 01:13:07 2011
@@ -21,6 +21,7 @@ import java.util.Set;
 
 import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.zookeeper.ZooUtil.NodeMissingPolicy;
+import org.apache.accumulo.server.zookeeper.IZooReaderWriter;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
 
 public class DeleteZooInstance {
@@ -34,7 +35,7 @@ public class DeleteZooInstance {
       System.err.println("Usage: " + DeleteZooInstance.class.getName() + " [instanceName|UUID ... ]");
       System.exit(1);
     }
-    ZooReaderWriter zk = ZooReaderWriter.getInstance();
+    IZooReaderWriter zk = ZooReaderWriter.getInstance();
     // try instance name:
     Set<String> instances = new HashSet<String>(zk.getChildren(Constants.ZROOT + Constants.ZINSTANCES));
     Set<String> uuids = new HashSet<String>(zk.getChildren(Constants.ZROOT));

Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/util/DumpZookeeper.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/util/DumpZookeeper.java?rev=1187617&r1=1187616&r2=1187617&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/util/DumpZookeeper.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/util/DumpZookeeper.java Sat Oct 22 01:13:07 2011
@@ -19,6 +19,7 @@ package org.apache.accumulo.server.util;
 import java.io.PrintStream;
 import java.io.UnsupportedEncodingException;
 
+import org.apache.accumulo.server.zookeeper.IZooReaderWriter;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
 import org.apache.commons.codec.binary.Base64;
 import org.apache.log4j.Level;
@@ -28,7 +29,7 @@ import org.apache.zookeeper.data.Stat;
 
 public class DumpZookeeper {
   
-  static ZooReaderWriter zk = null;
+  static IZooReaderWriter zk = null;
   
   private static final Logger log = Logger.getLogger(DumpZookeeper.class);
   

Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/util/Initialize.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/util/Initialize.java?rev=1187617&r1=1187616&r2=1187617&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/util/Initialize.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/util/Initialize.java Sat Oct 22 01:13:07 2011
@@ -50,6 +50,7 @@ import org.apache.accumulo.server.master
 import org.apache.accumulo.server.security.SecurityConstants;
 import org.apache.accumulo.server.security.ZKAuthenticator;
 import org.apache.accumulo.server.tabletserver.TabletTime;
+import org.apache.accumulo.server.zookeeper.IZooReaderWriter;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileStatus;
@@ -305,7 +306,7 @@ public class Initialize {
   
   private static void initZooKeeper(String uuid, String instanceNamePath) throws KeeperException, InterruptedException {
     // setup basic data in zookeeper
-    ZooReaderWriter zoo = ZooReaderWriter.getInstance();
+    IZooReaderWriter zoo = ZooReaderWriter.getInstance();
     ZooUtil.putPersistentData(zoo.getZooKeeper(), Constants.ZROOT, new byte[0], -1, NodeExistsPolicy.SKIP, Ids.OPEN_ACL_UNSAFE);
     ZooUtil.putPersistentData(zoo.getZooKeeper(), Constants.ZROOT + Constants.ZINSTANCES, new byte[0], -1, NodeExistsPolicy.SKIP, Ids.OPEN_ACL_UNSAFE);
     

Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/util/ListInstances.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/util/ListInstances.java?rev=1187617&r1=1187616&r2=1187617&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/util/ListInstances.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/util/ListInstances.java Sat Oct 22 01:13:07 2011
@@ -28,6 +28,7 @@ import java.util.UUID;
 import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.server.conf.ServerConfiguration;
+import org.apache.accumulo.server.zookeeper.IZooReaderWriter;
 import org.apache.accumulo.server.zookeeper.ZooLock;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
 import org.apache.log4j.Logger;
@@ -166,7 +167,7 @@ public class ListInstances {
   
   private static TreeMap<String,UUID> getInstanceNames() {
     
-    ZooReaderWriter zk = ZooReaderWriter.getInstance();
+    IZooReaderWriter zk = ZooReaderWriter.getInstance();
     String instancesPath = Constants.ZROOT + Constants.ZINSTANCES;
     
     TreeMap<String,UUID> tm = new TreeMap<String,UUID>();
@@ -197,7 +198,7 @@ public class ListInstances {
   private static TreeSet<UUID> getInstanceIDs() {
     TreeSet<UUID> ts = new TreeSet<UUID>();
     
-    ZooReaderWriter zk = ZooReaderWriter.getInstance();
+    IZooReaderWriter zk = ZooReaderWriter.getInstance();
     
     try {
       List<String> children = zk.getChildren(Constants.ZROOT);

Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/util/MetadataTable.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/util/MetadataTable.java?rev=1187617&r1=1187616&r2=1187617&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/util/MetadataTable.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/util/MetadataTable.java Sat Oct 22 01:13:07 2011
@@ -78,6 +78,7 @@ import org.apache.accumulo.server.master
 import org.apache.accumulo.server.security.SecurityConstants;
 import org.apache.accumulo.server.test.FastFormat;
 import org.apache.accumulo.server.trace.TraceFileSystem;
+import org.apache.accumulo.server.zookeeper.IZooReaderWriter;
 import org.apache.accumulo.server.zookeeper.ZooLock;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
 import org.apache.hadoop.fs.FileStatus;
@@ -155,7 +156,7 @@ public class MetadataTable extends org.a
       Set<String> filesInUseByScans, String address, ZooLock zooLock, Set<String> unusedWalLogs, TServerInstance lastLocation, long flushId) {
     if (extent.equals(Constants.ROOT_TABLET_EXTENT)) {
       if (unusedWalLogs != null) {
-        ZooReaderWriter zk = ZooReaderWriter.getInstance();
+        IZooReaderWriter zk = ZooReaderWriter.getInstance();
         // unusedWalLogs will contain the location/name of each log in a log set
         // the log set is stored under one of the log names, but not both
         // find the entry under one of the names and delete it.
@@ -372,7 +373,7 @@ public class MetadataTable extends org.a
   }
   
   public static boolean recordRootTabletLocation(String address) {
-    ZooReaderWriter zoo = ZooReaderWriter.getInstance();
+    IZooReaderWriter zoo = ZooReaderWriter.getInstance();
     for (int i = 0; i < SAVE_ROOT_TABLET_RETRIES; i++) {
       try {
         log.info("trying to write root tablet location to ZooKeeper as " + address);
@@ -790,7 +791,7 @@ public class MetadataTable extends org.a
       String root = getZookeeperLogLocation();
       while (true) {
         try {
-          ZooReaderWriter zoo = ZooReaderWriter.getInstance();
+          IZooReaderWriter zoo = ZooReaderWriter.getInstance();
           if (zoo.isLockHeld(zooLock.getLockID())) zoo.putPersistentData(root + "/" + entry.filename, entry.toBytes(), NodeExistsPolicy.OVERWRITE);
           break;
         } catch (KeeperException e) {
@@ -900,7 +901,7 @@ public class MetadataTable extends org.a
   }
   
   private static void getRootLogEntries(ArrayList<LogEntry> result) throws KeeperException, InterruptedException, IOException {
-    ZooReaderWriter zoo = ZooReaderWriter.getInstance();
+    IZooReaderWriter zoo = ZooReaderWriter.getInstance();
     String root = getZookeeperLogLocation();
     for (String child : zoo.getChildren(root)) {
       LogEntry e = new LogEntry();
@@ -966,7 +967,7 @@ public class MetadataTable extends org.a
         String root = getZookeeperLogLocation();
         while (true) {
           try {
-            ZooReaderWriter zoo = ZooReaderWriter.getInstance();
+            IZooReaderWriter zoo = ZooReaderWriter.getInstance();
             if (zoo.isLockHeld(zooLock.getLockID())) zoo.recursiveDelete(root + "/" + entry.filename, NodeMissingPolicy.SKIP);
             break;
           } catch (Exception e) {

Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/util/TabletServerLocks.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/util/TabletServerLocks.java?rev=1187617&r1=1187616&r2=1187617&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/util/TabletServerLocks.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/util/TabletServerLocks.java Sat Oct 22 01:13:07 2011
@@ -21,6 +21,7 @@ import java.util.List;
 import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.zookeeper.ZooUtil;
 import org.apache.accumulo.server.client.HdfsZooInstance;
+import org.apache.accumulo.server.zookeeper.IZooReaderWriter;
 import org.apache.accumulo.server.zookeeper.ZooLock;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
 
@@ -34,7 +35,7 @@ public class TabletServerLocks {
     String tserverPath = ZooUtil.getRoot(HdfsZooInstance.getInstance()) + Constants.ZTSERVERS;
     
     if (args.length == 1 && args[0].equals("-list")) {
-      ZooReaderWriter zoo = ZooReaderWriter.getInstance();
+      IZooReaderWriter zoo = ZooReaderWriter.getInstance();
       
       List<String> tabletServers = zoo.getChildren(tserverPath);
       

Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/util/ZooZap.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/util/ZooZap.java?rev=1187617&r1=1187616&r2=1187617&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/util/ZooZap.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/util/ZooZap.java Sat Oct 22 01:13:07 2011
@@ -21,6 +21,7 @@ import java.util.List;
 import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.zookeeper.ZooUtil.NodeMissingPolicy;
 import org.apache.accumulo.server.client.HdfsZooInstance;
+import org.apache.accumulo.server.zookeeper.IZooReaderWriter;
 import org.apache.accumulo.server.zookeeper.ZooLock;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
 
@@ -64,7 +65,7 @@ public class ZooZap {
       }
     }
     
-    ZooReaderWriter zoo = ZooReaderWriter.getInstance();
+    IZooReaderWriter zoo = ZooReaderWriter.getInstance();
     String iid = HdfsZooInstance.getInstance().getInstanceID();
     
     if (zapMaster) {
@@ -107,7 +108,7 @@ public class ZooZap {
     
   }
   
-  private static void zapDirectory(ZooReaderWriter zoo, String loggersPath) {
+  private static void zapDirectory(IZooReaderWriter zoo, String loggersPath) {
     try {
       List<String> children = zoo.getChildren(loggersPath);
       for (String child : children) {

Added: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/zookeeper/IZooReaderWriter.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/zookeeper/IZooReaderWriter.java?rev=1187617&view=auto
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/zookeeper/IZooReaderWriter.java (added)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/zookeeper/IZooReaderWriter.java Sat Oct 22 01:13:07 2011
@@ -0,0 +1,47 @@
+package org.apache.accumulo.server.zookeeper;
+
+import java.util.List;
+
+import org.apache.accumulo.core.zookeeper.IZooReader;
+import org.apache.accumulo.core.zookeeper.ZooUtil;
+import org.apache.accumulo.core.zookeeper.ZooUtil.NodeExistsPolicy;
+import org.apache.accumulo.core.zookeeper.ZooUtil.NodeMissingPolicy;
+import org.apache.accumulo.server.zookeeper.ZooReaderWriter.Mutator;
+import org.apache.zookeeper.KeeperException;
+import org.apache.zookeeper.ZooKeeper;
+import org.apache.zookeeper.data.ACL;
+
+public interface IZooReaderWriter extends IZooReader {
+  
+  public abstract ZooKeeper getZooKeeper();
+  
+  public abstract void recursiveDelete(String zPath, NodeMissingPolicy policy) throws KeeperException, InterruptedException;
+  
+  public abstract void recursiveDelete(String zPath, int version, NodeMissingPolicy policy) throws KeeperException, InterruptedException;
+  
+  /**
+   * Create a persistent node with the default ACL
+   * 
+   * @return true if the node was created or altered; false if it was skipped
+   */
+  public abstract boolean putPersistentData(String zPath, byte[] data, NodeExistsPolicy policy) throws KeeperException, InterruptedException;
+  
+  public abstract boolean putPrivatePersistentData(String zPath, byte[] data, NodeExistsPolicy policy) throws KeeperException, InterruptedException;
+  
+  public abstract void putPersistentData(String zPath, byte[] data, int version, NodeExistsPolicy policy) throws KeeperException, InterruptedException;
+  
+  public abstract String putPersistentSequential(String zPath, byte[] data) throws KeeperException, InterruptedException;
+  
+  public abstract String putEphemeralSequential(String zPath, byte[] data) throws KeeperException, InterruptedException;
+  
+  public abstract void recursiveCopyPersistent(String source, String destination, NodeExistsPolicy policy) throws KeeperException, InterruptedException;
+  
+  public abstract void delete(String path, int version) throws InterruptedException, KeeperException;
+  
+  public abstract byte[] mutate(String zPath, byte[] createValue, List<ACL> acl, Mutator mutator) throws Exception;
+  
+  public abstract boolean isLockHeld(ZooUtil.LockID lockID) throws KeeperException, InterruptedException;
+  
+  public abstract void mkdirs(String path) throws KeeperException, InterruptedException;
+  
+}
\ No newline at end of file

Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/zookeeper/TransactionWatcher.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/zookeeper/TransactionWatcher.java?rev=1187617&r1=1187616&r2=1187617&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/zookeeper/TransactionWatcher.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/zookeeper/TransactionWatcher.java Sat Oct 22 01:13:07 2011
@@ -52,14 +52,14 @@ public class TransactionWatcher {
     
     public static void start(String type, long tid) throws KeeperException, InterruptedException {
       Instance instance = HdfsZooInstance.getInstance();
-      ZooReaderWriter writer = ZooReaderWriter.getInstance();
+      IZooReaderWriter writer = ZooReaderWriter.getInstance();
       writer.putPersistentData(ZooUtil.getRoot(instance) + "/" + type, new byte[] {}, NodeExistsPolicy.OVERWRITE);
       writer.putPersistentData(ZooUtil.getRoot(instance) + "/" + type + "/" + tid, new byte[] {}, NodeExistsPolicy.OVERWRITE);
     }
     
     public static void stop(String type, long tid) throws KeeperException, InterruptedException {
       Instance instance = HdfsZooInstance.getInstance();
-      ZooReaderWriter writer = ZooReaderWriter.getInstance();
+      IZooReaderWriter writer = ZooReaderWriter.getInstance();
       writer.recursiveDelete(ZooUtil.getRoot(instance) + "/" + type + "/" + tid, NodeMissingPolicy.SKIP);
     }
   }

Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooLock.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooLock.java?rev=1187617&r1=1187616&r2=1187617&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooLock.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooLock.java Sat Oct 22 01:13:07 2011
@@ -53,7 +53,7 @@ public class ZooLock implements Watcher 
   
   private boolean lockWasAcquired;
   final private String path;
-  final private ZooReaderWriter zooKeeper;
+  final private IZooReaderWriter zooKeeper;
   private String lock;
   private LockWatcher lockWatcher;
   
@@ -399,7 +399,7 @@ public class ZooLock implements Watcher 
   public static void deleteLock(String path) throws InterruptedException, KeeperException {
     List<String> children;
     
-    ZooReaderWriter zk = ZooReaderWriter.getInstance();
+    IZooReaderWriter zk = ZooReaderWriter.getInstance();
     children = zk.getChildren(path);
     
     if (children.size() == 0) {
@@ -421,7 +421,7 @@ public class ZooLock implements Watcher 
   public static boolean deleteLock(String path, String lockData) throws InterruptedException, KeeperException {
     List<String> children;
     
-    ZooReaderWriter zk = ZooReaderWriter.getInstance();
+    IZooReaderWriter zk = ZooReaderWriter.getInstance();
     children = zk.getChildren(path);
     
     if (children.size() == 0) {

Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooQueueLock.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooQueueLock.java?rev=1187617&r1=1187616&r2=1187617&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooQueueLock.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooQueueLock.java Sat Oct 22 01:13:07 2011
@@ -36,12 +36,12 @@ public class ZooQueueLock implements Que
   
   // private static final Logger log = Logger.getLogger(ZooQueueLock.class);
   
-  private ZooReaderWriter zoo;
+  private IZooReaderWriter zoo;
   private String path;
   private boolean ephemeral;
   
   public ZooQueueLock(String path, boolean ephemeral) throws KeeperException, InterruptedException {
-    this.zoo = ZooReaderWriter.getInstance();
+    this.zoo = ZooReaderWriter.getRetryingInstance();
     this.path = path;
     this.ephemeral = ephemeral;
   }

Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooReaderWriter.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooReaderWriter.java?rev=1187617&r1=1187616&r2=1187617&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooReaderWriter.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooReaderWriter.java Sat Oct 22 01:13:07 2011
@@ -16,16 +16,22 @@
  */
 package org.apache.accumulo.server.zookeeper;
 
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
 import java.security.SecurityPermission;
 import java.util.List;
 
 import org.apache.accumulo.core.conf.AccumuloConfiguration;
 import org.apache.accumulo.core.conf.Property;
+import org.apache.accumulo.core.util.UtilWaitThread;
 import org.apache.accumulo.core.zookeeper.ZooReader;
 import org.apache.accumulo.core.zookeeper.ZooUtil;
 import org.apache.accumulo.core.zookeeper.ZooUtil.NodeExistsPolicy;
 import org.apache.accumulo.core.zookeeper.ZooUtil.NodeMissingPolicy;
 import org.apache.accumulo.server.conf.ServerConfiguration;
+import org.apache.log4j.Logger;
 import org.apache.zookeeper.CreateMode;
 import org.apache.zookeeper.KeeperException;
 import org.apache.zookeeper.KeeperException.BadVersionException;
@@ -34,13 +40,14 @@ import org.apache.zookeeper.ZooKeeper;
 import org.apache.zookeeper.data.ACL;
 import org.apache.zookeeper.data.Stat;
 
-public class ZooReaderWriter extends ZooReader {
+public class ZooReaderWriter extends ZooReader implements IZooReaderWriter {
   
   private static SecurityPermission ZOOWRITER_PERMISSION = new SecurityPermission("zookeeperWriterPermission");
   
   private static ZooReaderWriter instance = null;
+  private static IZooReaderWriter retryingInstance = null;
   private final String auth;
-  
+
   @Override
   public ZooKeeper getZooKeeper() {
     SecurityManager sm = System.getSecurityManager();
@@ -55,10 +62,12 @@ public class ZooReaderWriter extends Zoo
     this.auth = "accumulo:" + auth;
   }
   
+  @Override
   public void recursiveDelete(String zPath, NodeMissingPolicy policy) throws KeeperException, InterruptedException {
     ZooUtil.recursiveDelete(getZooKeeper(), zPath, policy);
   }
   
+  @Override
   public void recursiveDelete(String zPath, int version, NodeMissingPolicy policy) throws KeeperException, InterruptedException {
     ZooUtil.recursiveDelete(getZooKeeper(), zPath, version, policy);
   }
@@ -68,30 +77,37 @@ public class ZooReaderWriter extends Zoo
    * 
    * @return true if the node was created or altered; false if it was skipped
    */
+  @Override
   public boolean putPersistentData(String zPath, byte[] data, NodeExistsPolicy policy) throws KeeperException, InterruptedException {
     return ZooUtil.putPersistentData(getZooKeeper(), zPath, data, policy);
   }
   
+  @Override
   public boolean putPrivatePersistentData(String zPath, byte[] data, NodeExistsPolicy policy) throws KeeperException, InterruptedException {
     return ZooUtil.putPrivatePersistentData(getZooKeeper(), zPath, data, policy);
   }
   
+  @Override
   public void putPersistentData(String zPath, byte[] data, int version, NodeExistsPolicy policy) throws KeeperException, InterruptedException {
     ZooUtil.putPersistentData(getZooKeeper(), zPath, data, version, policy);
   }
   
+  @Override
   public String putPersistentSequential(String zPath, byte[] data) throws KeeperException, InterruptedException {
     return ZooUtil.putPersistentSequential(getZooKeeper(), zPath, data);
   }
   
+  @Override
   public String putEphemeralSequential(String zPath, byte[] data) throws KeeperException, InterruptedException {
     return ZooUtil.putEphemeralSequential(getZooKeeper(), zPath, data);
   }
   
+  @Override
   public void recursiveCopyPersistent(String source, String destination, NodeExistsPolicy policy) throws KeeperException, InterruptedException {
     ZooUtil.recursiveCopyPersistent(getZooKeeper(), source, destination, policy);
   }
   
+  @Override
   public void delete(String path, int version) throws InterruptedException, KeeperException {
     getZooKeeper().delete(path, version);
   }
@@ -100,6 +116,7 @@ public class ZooReaderWriter extends Zoo
     byte[] mutate(byte[] currentValue) throws Exception;
   }
   
+  @Override
   public byte[] mutate(String zPath, byte[] createValue, List<ACL> acl, Mutator mutator) throws Exception {
     if (createValue != null) {
       try {
@@ -132,10 +149,48 @@ public class ZooReaderWriter extends Zoo
     return instance;
   }
   
+  /**
+   * get an instance that retries when zookeeper connection errors occur
+   * 
+   * @return
+   */
+  public static synchronized IZooReaderWriter getRetryingInstance() {
+    
+    if(retryingInstance == null){
+      final IZooReaderWriter inst = getInstance();
+      
+      InvocationHandler ih = new InvocationHandler() {
+        @Override
+        public Object invoke(Object obj, Method method, Object[] args) throws Throwable {
+          long retryTime = 250;
+          while(true){
+            try {
+              return method.invoke(inst, args);
+            } catch (InvocationTargetException e) {
+              if(e.getCause() instanceof KeeperException.ConnectionLossException){
+                Logger.getLogger(ZooReaderWriter.class).warn("Error connecting to zookeeper, will retry in "+retryTime, e.getCause());
+                UtilWaitThread.sleep(retryTime);
+                retryTime = Math.min(5000, retryTime + 250);
+              }else{
+                throw e.getCause();
+              }
+            }
+          }
+        }
+      };
+      
+      retryingInstance = (IZooReaderWriter) Proxy.newProxyInstance(ZooReaderWriter.class.getClassLoader(),new Class[] {IZooReaderWriter.class}, ih);
+    }
+    
+    return retryingInstance;
+  }
+  
+  @Override
   public boolean isLockHeld(ZooUtil.LockID lockID) throws KeeperException, InterruptedException {
     return ZooUtil.isLockHeld(getZooKeeper(), lockID);
   }
   
+  @Override
   public void mkdirs(String path) throws KeeperException, InterruptedException {
     if (path.equals("")) return;
     if (!path.startsWith("/")) throw new IllegalArgumentException(path + "does not start with /");

Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooReservation.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooReservation.java?rev=1187617&r1=1187616&r2=1187617&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooReservation.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooReservation.java Sat Oct 22 01:13:07 2011
@@ -26,7 +26,7 @@ import org.apache.zookeeper.data.Stat;
 
 public class ZooReservation {
   
-  public static boolean attempt(ZooReaderWriter zk, String path, String reservationID, String debugInfo) throws KeeperException, InterruptedException {
+  public static boolean attempt(IZooReaderWriter zk, String path, String reservationID, String debugInfo) throws KeeperException, InterruptedException {
     if (reservationID.contains(":")) throw new IllegalArgumentException();
     
     while (true) {
@@ -50,7 +50,7 @@ public class ZooReservation {
     
   }
   
-  public static void release(ZooReaderWriter zk, String path, String reservationID) throws KeeperException, InterruptedException {
+  public static void release(IZooReaderWriter zk, String path, String reservationID) throws KeeperException, InterruptedException {
     Stat stat = new Stat();
     byte[] zooData;
     



Mime
View raw message