Examples of DataTree


Examples of org.apache.zookeeper.server.DataTree

    @Test
    public void testTxnFailure() throws Exception {
        long count = 1;
        File tmpDir = ClientBase.createTmpDir();
        FileTxnSnapLog logFile = new FileTxnSnapLog(tmpDir, tmpDir);
        DataTree dt = new DataTree();
        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

Examples of org.apache.zookeeper.server.DataTree

        // read old database and create
        // an old snapshot
        UpgradeSnapShotV1 upgrade = new UpgradeSnapShotV1(bkupdataDir,
                bkupsnapShotDir);
        LOG.info("Creating new data tree");
        DataTree dt = upgrade.getNewDataTree();
        FileTxnSnapLog filesnapLog = new FileTxnSnapLog(dataDir,
                snapShotDir);
        LOG.info("snapshotting the new datatree");
        filesnapLog.save(dt, upgrade.getSessionWithTimeOuts());
        //done saving.
View Full Code Here

Examples of org.apache.zookeeper.server.DataTree

        }
    }  
   
    private DataTree convertThisSnapShot() throws IOException {
        // create a datatree
        DataTree dataTree = new DataTree();
        DataNodeV1 oldDataNode = oldDataTree.getNode("");
        if (oldDataNode == null) {
            //should never happen
            LOG.error("Upgrading from an empty snapshot.");
        }
View Full Code Here

Examples of org.apache.zookeeper.server.DataTree

        return dataTree;
    }
   
    public DataTree getNewDataTree() throws IOException {
        loadThisSnapShot();
        DataTree dt = convertThisSnapShot();
        return dt;
    }
View Full Code Here

Examples of org.apache.zookeeper.server.DataTree

        }
    }  
   
    private DataTree convertThisSnapShot() throws IOException {
        // create a datatree
        DataTree dataTree = new DataTree();
        DataNodeV1 oldDataNode = oldDataTree.getNode("");
        if (oldDataNode == null) {
            //should never happen
            LOG.error("Upgrading from an empty snapshot.");
        }
View Full Code Here

Examples of org.apache.zookeeper.server.DataTree

        return dataTree;
    }
   
    public DataTree getNewDataTree() throws IOException {
        loadThisSnapShot();
        DataTree dt = convertThisSnapShot();
        return dt;
    }
View Full Code Here

Examples of org.apache.zookeeper.server.DataTree

  private static void readSnapshotLog(String snapshotPath) throws Exception
  {
    FileInputStream fis = new FileInputStream(snapshotPath);
    BinaryInputArchive ia = BinaryInputArchive.getArchive(fis);
    Map<Long, Integer> sessions = new HashMap<Long, Integer>();
    DataTree dt = new DataTree();
    FileHeader header = new FileHeader();
    header.deserialize(ia, "fileheader");
    if (header.getMagic() != FileSnap.SNAP_MAGIC)
    {
      throw new IOException("mismatching magic headers " + header.getMagic()
View Full Code Here

Examples of org.apache.zookeeper.server.DataTree

            super(Arrays.asList("watches", "wchc"));
        }

        @Override
        public CommandResponse run(ZooKeeperServer zkServer, Map<String, String> kwargs) {
            DataTree dt = zkServer.getZKDatabase().getDataTree();
            CommandResponse response = initializeResponse();
            response.put("session_id_to_watched_paths", dt.getWatches().toMap());
            return response;
        }
View Full Code Here

Examples of org.apache.zookeeper.server.DataTree

            super(Arrays.asList("watches_by_path", "wchp"));
        }

        @Override
        public CommandResponse run(ZooKeeperServer zkServer, Map<String, String> kwargs) {
            DataTree dt = zkServer.getZKDatabase().getDataTree();
            CommandResponse response = initializeResponse();
            response.put("path_to_session_ids", dt.getWatchesByPath().toMap());
            return response;
        }
View Full Code Here

Examples of org.apache.zookeeper.server.DataTree

            super(Arrays.asList("watch_summary", "wchs"));
        }

        @Override
        public CommandResponse run(ZooKeeperServer zkServer, Map<String, String> kwargs) {
            DataTree dt = zkServer.getZKDatabase().getDataTree();
            CommandResponse response = initializeResponse();
            response.putAll(dt.getWatchesSummary().toMap());
            return response;
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.