/** Test specific setup */ public static void setupTestEnv() { // during the tests we run with 100K prealloc in the logs. // on windows systems prealloc of 64M was seen to take ~15seconds // resulting in test Assert.failure (client timeout on first session). // set env and directly in order to handle static init/gc issues System.setProperty("zookeeper.preAllocSize", "100"); FileTxnLog.setPreallocSize(100 * 1024); }
// / XXX: From o.a.zk.t.ClientBase private static void setupTestEnv() { // during the tests we run with 100K prealloc in the logs. // on windows systems prealloc of 64M was seen to take ~15seconds // resulting in test failure (client timeout on first session). // set env and directly in order to handle static init/gc issues // Lily change: make preAllocSize larger again: otherwise, on the next restart, ZooKeeper // FileTxnLog // throw a CRC error reading the log. Not sure why, as this pre-allocation should only be an // optimization. System.setProperty("zookeeper.preAllocSize", String.valueOf(8192 * 1024)); FileTxnLog.setPreallocSize(8192 * 1024); }
/** * create the old snapshot database apply logs to it and create the final database * * @throws IOException */ private void loadThisSnapShot() throws IOException { // pick the most recent snapshot File snapshot = findMostRecentSnapshot(); if (snapshot == null) { throw new IOException("Invalid snapshots " + "or not snapshots in " + snapShotDir); } InputStream inputstream = new BufferedInputStream(new FileInputStream(snapshot)); InputArchive ia = BinaryInputArchive.getArchive(inputstream); deserializeSnapshot(oldDataTree, ia, sessionsWithTimeouts); // ok done with the snapshot // now apply the logs long snapshotZxid = oldDataTree.lastProcessedZxid; File[] files = FileTxnLog.getLogFiles(dataDir.listFiles(), snapshotZxid); long zxid = processLogFiles(oldDataTree, files); // check for this zxid to be sane if (zxid != oldDataTree.lastProcessedZxid) { LOG.error( "Zxids not equal " + " log zxid " + zxid + " datatree processed " + oldDataTree.lastProcessedZxid); } }