Package org.apache.zookeeper.server

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


  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() + " !=  "
          + FileSnap.SNAP_MAGIC);
View Full Code Here

public class DataTreeUnitTest extends TestCase {
    DataTree dt;
   
    public void setUp() throws Exception {
        dt=new DataTree();
    }
View Full Code Here

    private DataTree dt;

    @Override
    public void setUp() throws Exception {
        LOG.info("STARTING " + getName());
        dt=new DataTree();
    }
View Full Code Here

    private DataTree dt;

    @Override
    public void setUp() throws Exception {
        LOG.info("STARTING " + getName());
        dt=new DataTree();
    }
View Full Code Here

    @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);
        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

    private DataTree dt;

    @Override
    public void setUp() throws Exception {
        LOG.info("STARTING " + getName());
        dt=new DataTree();
    }
View Full Code Here

    @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

        // 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

        }
    }  
   
    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

TOP

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

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.