Package org.apache.zookeeper.server

Examples of org.apache.zookeeper.server.DataNode


    queue.add(new Pair(startPath, startId));
    while (!queue.isEmpty())
    {
      Pair pair = queue.removeFirst();
      String path = pair._path;
      DataNode head = dt.getNode(path);
      Stat stat = new Stat();
      byte[] data = null;
      try
      {
        data = dt.getData(path, stat, null);
      } catch (NoNodeException e)
      {
        e.printStackTrace();
      }
      // print the node
      format(startId, pair, head, data);
      Set<String> children = head.getChildren();
      if (children != null)
      {
        for (String child : children)
        {
          String childPath;
View Full Code Here


    LinkedList<Pair> queue = new LinkedList<Pair>();
    queue.add(new Pair(startPath, startId));
    while (!queue.isEmpty()) {
      Pair pair = queue.removeFirst();
      String path = pair._path;
      DataNode head = dt.getNode(path);
      Stat stat = new Stat();
      byte[] data = null;
      try {
        data = dt.getData(path, stat, null);
      } catch (NoNodeException e) {
        e.printStackTrace();
      }
      // print the node
      format(startId, pair, head, data);
      Set<String> children = head.getChildren();
      if (children != null) {
        for (String child : children) {
          String childPath;
          if (path.endsWith("/")) {
            childPath = path + child;
View Full Code Here

        dt.createNode("/test", new byte[0], null, 0, 1, 1);
        for (count = 1; count <= 3; count++) {
            dt.createNode("/test/" + count, new byte[0], null, 0, count,
                    System.currentTimeMillis());
        }
        DataNode zk = dt.getNode("/test");

        // Make create to fail, then verify cversion.
     
        doOp(logFile, OpCode.create, "/test/" + (count - 1), dt, zk);
View Full Code Here

     * For ZOOKEEPER-1046 test if cversion is getting incremented correctly.
     */
    @Test
    public void testIncrementCversion() throws Exception {
        dt.createNode("/test", new byte[0], null, 0, 1, 1);
        DataNode zk = dt.getNode("/test");
        long prevCversion = zk.stat.getCversion();
        long prevPzxid = zk.stat.getPzxid();
        dt.incrementCversion("/test/",  prevPzxid + 1);
        long newCversion = zk.stat.getCversion();
        long newPzxid = zk.stat.getPzxid();
View Full Code Here

        dt.createNode("/test", new byte[0], null, 0, -1, 1, 1);
        for (count = 1; count <= 3; count++) {
            dt.createNode("/test/" + count, new byte[0], null, 0, -1, count,
                    System.currentTimeMillis());
        }
        DataNode zk = dt.getNode("/test");

        // Make create to fail, then verify cversion.
        LOG.info("Attempting to create " + "/test/" + (count - 1));
        doOp(logFile, OpCode.create, "/test/" + (count - 1), dt, zk, -1);
View Full Code Here

     * @return the new datanode
     */
    private DataNode convertDataNode(DataTree dt, DataNode parent,
            DataNodeV1 oldDataNode) {
        StatPersisted stat = convertStat(oldDataNode.stat);
        DataNode dataNode =  new DataNode(parent, oldDataNode.data,
                dt.convertAcls(oldDataNode.acl), stat);
        dataNode.setChildren(oldDataNode.children);
        return dataNode;
    }
View Full Code Here

    private void recurseThroughDataTree(DataTree dataTree, String path) {
        if (path == null)
            return;
        DataNodeV1 oldDataNode = oldDataTree.getNode(path);
        HashSet<String> children = oldDataNode.children;
        DataNode parent = null;
        if ("".equals(path)) {
            parent = null;
        }
        else {
            int lastSlash = path.lastIndexOf('/');
            String parentPath = path.substring(0, lastSlash);
            parent = dataTree.getNode(parentPath);
        }
        DataNode thisDatNode = convertDataNode(dataTree, parent,
                                    oldDataNode);
        dataTree.addDataNode(path, thisDatNode);
        if (children == null || children.size() == 0) {
            return;
        }
View Full Code Here

     * @return the new datanode
     */
    private DataNode convertDataNode(DataTree dt, DataNode parent,
            DataNodeV1 oldDataNode) {
        StatPersisted stat = convertStat(oldDataNode.stat);
        DataNode dataNode =  new DataNode(parent, oldDataNode.data,
                dt.convertAcls(oldDataNode.acl), stat);
        dataNode.setChildren(oldDataNode.children);
        return dataNode;
    }
View Full Code Here

    private void recurseThroughDataTree(DataTree dataTree, String path) {
        if (path == null)
            return;
        DataNodeV1 oldDataNode = oldDataTree.getNode(path);
        HashSet<String> children = oldDataNode.children;
        DataNode parent = null;
        if ("".equals(path)) {
            parent = null;
        }
        else {
            int lastSlash = path.lastIndexOf('/');
            String parentPath = path.substring(0, lastSlash);
            parent = dataTree.getNode(parentPath);
        }
        DataNode thisDatNode = convertDataNode(dataTree, parent,
                                    oldDataNode);
        dataTree.addDataNode(path, thisDatNode);
        if (children == null || children.size() == 0) {
            return;
        }
View Full Code Here

     * For ZOOKEEPER-1046 test if cversion is getting incremented correctly.
     */
    @Test
    public void testIncrementCversion() throws Exception {
        dt.createNode("/test", new byte[0], null, 0, dt.getNode("/").stat.getCversion()+1, 1, 1);
        DataNode zk = dt.getNode("/test");
        int prevCversion = zk.stat.getCversion();
        long prevPzxid = zk.stat.getPzxid();
        dt.setCversionPzxid("/test/",  prevCversion + 1, prevPzxid + 1);
        int newCversion = zk.stat.getCversion();
        long newPzxid = zk.stat.getPzxid();
View Full Code Here

TOP

Related Classes of org.apache.zookeeper.server.DataNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.