use of org.apache.zookeeper.server.persistence.TxnLog in project zookeeper by apache.
the class LogChopperTest method getFirstLastZxid.
Pair<Long, Long> getFirstLastZxid(File logFile) throws IOException {
File tmp = createTmpDir();
Files.copy(logFile.toPath(), new File(tmp, "log.0").toPath());
FileTxnLog txnLog = new FileTxnLog(tmp);
TxnLog.TxnIterator it = txnLog.read(0);
long firstZxid = it.getHeader().getZxid();
long lastZxid = firstZxid;
while (it.next()) {
lastZxid = it.getHeader().getZxid();
}
txnLog.close();
rmr(tmp);
return new Pair<Long, Long>(firstZxid, lastZxid);
}
Aggregations