Search in sources :

Example 6 with TxnDigest

use of org.apache.zookeeper.txn.TxnDigest in project zookeeper by apache.

the class FileTxnSnapLogTest method attemptAutoCreateDB.

private void attemptAutoCreateDB(File dataDir, File snapDir, Map<Long, Integer> sessions, String autoCreateValue, long expectedValue) throws IOException {
    sessions.clear();
    FileTxnSnapLog fileTxnSnapLog = createFileTxnSnapLogWithAutoCreateDB(dataDir, snapDir, autoCreateValue);
    long zxid = fileTxnSnapLog.restore(new DataTree(), sessions, new FileTxnSnapLog.PlayBackListener() {

        @Override
        public void onTxnLoaded(TxnHeader hdr, Record rec, TxnDigest digest) {
        // empty by default
        }
    });
    assertEquals(expectedValue, zxid, "unexpected zxid");
}
Also used : DataTree(org.apache.zookeeper.server.DataTree) Record(org.apache.jute.Record) TxnDigest(org.apache.zookeeper.txn.TxnDigest) TxnHeader(org.apache.zookeeper.txn.TxnHeader)

Aggregations

TxnDigest (org.apache.zookeeper.txn.TxnDigest)6 Record (org.apache.jute.Record)4 TxnHeader (org.apache.zookeeper.txn.TxnHeader)4 TxnLogEntry (org.apache.zookeeper.server.TxnLogEntry)3 SetDataTxn (org.apache.zookeeper.txn.SetDataTxn)3 IOException (java.io.IOException)2 ByteBuffer (java.nio.ByteBuffer)2 Request (org.apache.zookeeper.server.Request)2 QuorumVerifier (org.apache.zookeeper.server.quorum.flexible.QuorumVerifier)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 EOFException (java.io.EOFException)1 File (java.io.File)1 BinaryInputArchive (org.apache.jute.BinaryInputArchive)1 InputArchive (org.apache.jute.InputArchive)1 DataTree (org.apache.zookeeper.server.DataTree)1 SimpleCounter (org.apache.zookeeper.server.metric.SimpleCounter)1 FileTxnLog (org.apache.zookeeper.server.persistence.FileTxnLog)1 TxnIterator (org.apache.zookeeper.server.persistence.TxnLog.TxnIterator)1 QuorumPeerMainTest (org.apache.zookeeper.server.quorum.QuorumPeerMainTest)1 CloseSessionTxn (org.apache.zookeeper.txn.CloseSessionTxn)1