accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [4/6] git commit: Merge branch '1.5' into 1.6
Date Fri, 31 Oct 2014 17:39:32 GMT
Merge branch '1.5' into 1.6

Conflicts:
	fate/src/main/java/org/apache/accumulo/fate/zookeeper/IZooReaderWriter.java
	fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooReaderWriter.java
	fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooUtil.java


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/f74681b3
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/f74681b3
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/f74681b3

Branch: refs/heads/master
Commit: f74681b37e5ed6fcb8466b2c1ccd5d9b8c266ddf
Parents: 443ae2d 69d665c
Author: Josh Elser <elserj@apache.org>
Authored: Fri Oct 31 13:38:58 2014 -0400
Committer: Josh Elser <elserj@apache.org>
Committed: Fri Oct 31 13:38:58 2014 -0400

----------------------------------------------------------------------
 .../apache/accumulo/fate/zookeeper/IZooReaderWriter.java |  2 --
 .../java/org/apache/accumulo/fate/zookeeper/ZooLock.java |  5 ++---
 .../apache/accumulo/fate/zookeeper/ZooReaderWriter.java  |  5 -----
 .../apache/accumulo/fate/zookeeper/ZooReservation.java   |  5 ++---
 .../java/org/apache/accumulo/fate/zookeeper/ZooUtil.java | 11 ++++-------
 5 files changed, 8 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/f74681b3/fate/src/main/java/org/apache/accumulo/fate/zookeeper/IZooReaderWriter.java
----------------------------------------------------------------------
diff --cc fate/src/main/java/org/apache/accumulo/fate/zookeeper/IZooReaderWriter.java
index 5b0a304,8ae507a..ad2a191
--- a/fate/src/main/java/org/apache/accumulo/fate/zookeeper/IZooReaderWriter.java
+++ b/fate/src/main/java/org/apache/accumulo/fate/zookeeper/IZooReaderWriter.java
@@@ -25,46 -26,39 +25,44 @@@ 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;
 -  
 +
 +  ZooKeeper getZooKeeper();
 +
 +  void recursiveDelete(String zPath, NodeMissingPolicy policy) throws KeeperException, InterruptedException;
 +
-   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 String putEphemeralData(String zPath, byte[] data) throws KeeperException, InterruptedException;
 +  boolean putPersistentData(String zPath, byte[] data, NodeExistsPolicy policy) 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;
 -  
 -  @Override
 -  public abstract void sync(String path) throws KeeperException, InterruptedException;
 +  boolean putPrivatePersistentData(String zPath, byte[] data, NodeExistsPolicy policy) throws
KeeperException, InterruptedException;
 +
 +  void putPersistentData(String zPath, byte[] data, int version, NodeExistsPolicy policy)
throws KeeperException, InterruptedException;
    
 +  boolean putPersistentData(String zPath, byte[] data, int version, NodeExistsPolicy policy,
List<ACL> acls) throws KeeperException, InterruptedException;
 +
 +  String putPersistentSequential(String zPath, byte[] data) throws KeeperException, InterruptedException;
 +
 +  String putEphemeralSequential(String zPath, byte[] data) throws KeeperException, InterruptedException;
 +
 +  String putEphemeralData(String zPath, byte[] data) throws KeeperException, InterruptedException;
 +
 +  void recursiveCopyPersistent(String source, String destination, NodeExistsPolicy policy)
throws KeeperException, InterruptedException;
 +
 +  void delete(String path, int version) throws InterruptedException, KeeperException;
 +
 +  interface Mutator {
 +    byte[] mutate(byte[] currentValue) throws Exception;
 +  }
 +
 +  byte[] mutate(String zPath, byte[] createValue, List<ACL> acl, Mutator mutator)
throws Exception;
 +
 +  boolean isLockHeld(ZooUtil.LockID lockID) throws KeeperException, InterruptedException;
 +
 +  void mkdirs(String path) throws KeeperException, InterruptedException;
 +
 +  void sync(String path) throws KeeperException, InterruptedException;
 +
  }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/f74681b3/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/accumulo/blob/f74681b3/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooReaderWriter.java
----------------------------------------------------------------------
diff --cc fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooReaderWriter.java
index 5b6447c,f1ce15b..38c7b64
--- a/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooReaderWriter.java
+++ b/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooReaderWriter.java
@@@ -53,23 -56,17 +53,18 @@@ public class ZooReaderWriter extends Zo
    public ZooReaderWriter(String string, int timeInMillis, String scheme, byte[] auth) {
      super(string, timeInMillis);
      this.scheme = scheme;
 -    this.auth = auth;
 +    this.auth = Arrays.copyOf(auth, auth.length);
 +    this.info = new ZooKeeperConnectionInfo(string, timeInMillis, scheme, this.auth);
    }
 -  
 +
    @Override
    public void recursiveDelete(String zPath, NodeMissingPolicy policy) throws KeeperException,
InterruptedException {
 -    ZooUtil.recursiveDelete(getZooKeeper(), zPath, policy);
 +    ZooUtil.recursiveDelete(info, zPath, policy);
    }
 -  
 +
-   @Override
-   public void recursiveDelete(String zPath, int version, NodeMissingPolicy policy) throws
KeeperException, InterruptedException {
-     ZooUtil.recursiveDelete(info, zPath, version, policy);
-   }
- 
    /**
     * Create a persistent node with the default ACL
 -   * 
 +   *
     * @return true if the node was created or altered; false if it was skipped
     */
    @Override

http://git-wip-us.apache.org/repos/asf/accumulo/blob/f74681b3/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooUtil.java
----------------------------------------------------------------------
diff --cc fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooUtil.java
index 1a3af6b,7ccc73a..2b2f5c7
--- a/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooUtil.java
+++ b/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooUtil.java
@@@ -192,58 -96,17 +192,59 @@@ public class ZooUtil 
     * @param zPath
     *          the path to delete
     */
-   static void recursiveDelete(ZooKeeperConnectionInfo info, String zPath, int version, NodeMissingPolicy
policy) throws KeeperException, InterruptedException {
 -  public static void recursiveDelete(ZooKeeper zk, String zPath, int version, NodeMissingPolicy
policy) throws KeeperException, InterruptedException {
++  static void recursiveDelete(ZooKeeperConnectionInfo info, String zPath, NodeMissingPolicy
policy) throws KeeperException, InterruptedException {
      if (policy.equals(NodeMissingPolicy.CREATE))
        throw new IllegalArgumentException(policy.name() + " is invalid for this operation");
      try {
 -      for (String child : zk.getChildren(zPath, false))
 -        recursiveDelete(zk, zPath + "/" + child, NodeMissingPolicy.SKIP);
 +      List<String> children;
 +      final Retry retry = RETRY_FACTORY.create();
 +      while (true) {
 +        try {
 +          children = getZooKeeper(info).getChildren(zPath, false);
 +          break;
 +        } catch (KeeperException e) {
 +          final Code c = e.code();
 +          if (c == Code.CONNECTIONLOSS || c == Code.OPERATIONTIMEOUT || c == Code.SESSIONEXPIRED)
{
 +            retryOrThrow(retry, e);
 +          } else {
 +            throw e;
 +          }
 +        }
 +        retry.waitForNextAttempt();
 +      }
 +      for (String child : children)
 +        recursiveDelete(info, zPath + "/" + child, NodeMissingPolicy.SKIP);
 +
 +      Stat stat;
 +      while (true) {
 +        try {
 +          stat = getZooKeeper(info).exists(zPath, null);
 +          // Node exists
 +          if (stat != null) {
 +            try {
-               // Try to delete it
-               getZooKeeper(info).delete(zPath, stat.getVersion());
++              // Try to delete it. We don't care if there was an update to the node
++              // since we got the Stat, just delete all versions (-1).
++              getZooKeeper(info).delete(zPath, -1);
 +              return;
 +            } catch (NoNodeException e) {
 +              // If the node is gone now, it's ok if we have SKIP
 +              if (policy.equals(NodeMissingPolicy.SKIP)) {
 +                return;
 +              }
 +              throw e;
 +            }
 +            // Let other KeeperException bubble to the outer catch
 +          }
 +        } catch (KeeperException e) {
 +          final Code c = e.code();
 +          if (c == Code.CONNECTIONLOSS || c == Code.OPERATIONTIMEOUT || c == Code.SESSIONEXPIRED)
{
 +            retryOrThrow(retry, e);
 +          } else {
 +            throw e;
 +          }
 +        }
  
 -      if (zk.exists(zPath, null) != null) {
 -        // Try to delete it. We don't care if there was an update to the node
 -        // since we got the Stat, just delete all versions (-1).
 -        zk.delete(zPath, -1);
 +        retry.waitForNextAttempt();
        }
      } catch (KeeperException e) {
        if (policy.equals(NodeMissingPolicy.SKIP) && e.code().equals(KeeperException.Code.NONODE))
@@@ -252,10 -115,10 +253,6 @@@
      }
    }
  
-   public static void recursiveDelete(ZooKeeperConnectionInfo info, String zPath, NodeMissingPolicy
policy) throws KeeperException, InterruptedException {
-     recursiveDelete(info, zPath, -1, policy);
-   }
- 
 -  public static void recursiveDelete(ZooKeeper zk, String zPath, NodeMissingPolicy policy)
throws KeeperException, InterruptedException {
 -    recursiveDelete(zk, zPath, -1, policy);
 -  }
 -
    /**
     * Create a persistent node with the default ACL
     *


Mime
View raw message