List of usage examples for org.apache.zookeeper.server.persistence FileTxnLog setPreallocSize
public static void setPreallocSize(long size)
From source file:com.uber.hoodie.common.minicluster.ZookeeperTestService.java
License:Apache License
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 System.setProperty("zookeeper.preAllocSize", "100"); FileTxnLog.setPreallocSize(100 * 1024); }
From source file:org.apache.bookkeeper.util.ClientBase.java
License:Apache License
/** * Test specific setup//from ww w .jav a 2 s . c o m */ 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 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); }
From source file:org.apache.hadoop.ha.ClientBaseWithFixes.java
License:Apache License
/** * Test specific setup/* w ww. ja v a2 s . co m*/ */ 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); }
From source file:org.apache.hadoop.hbase.MiniZooKeeperCluster.java
License:Apache License
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 System.setProperty("zookeeper.preAllocSize", "100"); FileTxnLog.setPreallocSize(100); }
From source file:org.apache.hadoop.yarn.lib.TestZKClient.java
License:Apache License
@Before public void setUp() throws IOException, InterruptedException { System.setProperty("zookeeper.preAllocSize", "100"); FileTxnLog.setPreallocSize(100 * 1024); if (!BASETEST.exists()) { BASETEST.mkdirs();/* www . j av a 2s . co m*/ } File dataDir = createTmpDir(BASETEST); zks = new ZooKeeperServer(dataDir, dataDir, 3000); final int PORT = Integer.parseInt(hostPort.split(":")[1]); if (factory == null) { factory = new NIOServerCnxnFactory(); factory.configure(new InetSocketAddress(PORT), maxCnxns); } factory.startup(zks); Assert.assertTrue("waiting for server up", waitForServerUp("127.0.0.1:" + PORT, CONNECTION_TIMEOUT)); }
From source file:org.fusesource.meshkeeper.distribution.registry.zk.ZooKeeperServer.java
License:Open Source License
public void start() throws Exception { File file = new File(directory); boolean doPurge = purge; // NOTE: this doesn't always work, since zk hangs on to file locks // It aslo can cause ZK to fail with CRC exceptions when running in // embedded mode: // // if (doPurge && file.exists()) { // log.debug("Attempting to delete zk data"); // try {/*from w w w.j a v a2 s .c o m*/ // FileSupport.recursiveDelete(file.getCanonicalPath()); // doPurge = false; // file.mkdirs(); // } catch (Exception e) { // log.debug("Error purging store (likely a benign zoo-keeper bug)", e); // } // } // Reduces startup time, and doesn't waste space: int preallocateSize = 1024; System.setProperty("zookeeper.preAllocSize", "" + preallocateSize); FileTxnLog.setPreallocSize(preallocateSize); log.debug("Preallocate Size: " + preallocateSize); org.apache.zookeeper.server.ZooKeeperServer zkServer = new org.apache.zookeeper.server.ZooKeeperServer(); FileTxnSnapLog ftxn = new FileTxnSnapLog(file, file); zkServer.setTxnLogFactory(ftxn); zkServer.setTickTime(tick); // serverFactory = new NIOServerCnxn.Factory(port); serverFactory = new NIOServerCnxn.Factory(new InetSocketAddress(port)); serverFactory.startup(zkServer); // InetAddress address = serverFactory.getLocalAddress().getAddress(); String actualHost = InetAddress.getLocalHost().getCanonicalHostName(); serviceUri = "zk:tcp://" + actualHost + ":" + zkServer.getClientPort(); if (doPurge) { if (log.isDebugEnabled()) { log.debug("Purging registry"); } RegistryClient zk = null; try { zk = new ZooKeeperFactory().createPlugin(getServiceUri()); zk.removeRegistryData("/", true); } catch (Exception e) { log.warn("Error purging registry", e); } finally { zk.destroy(); } } }
From source file:org.kiji.bento.BentoMiniZooKeeperCluster.java
License:Apache License
/** * Configures the pre-allocation size of logs. Taken from * {@link org.apache.hadoop.hbase.zookeeper.MiniZooKeeperCluster}. *//*from w w w. ja v a 2s . c o m*/ 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 System.setProperty("zookeeper.preAllocSize", "100"); FileTxnLog.setPreallocSize(100 * 1024); }
From source file:org.lilyproject.hadooptestfw.fork.MiniZooKeeperCluster.java
License:Apache License
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); }