public long approximateDataSize() { return dataTree.approximateDataSize(); }
public DataTree() { /* Rather than fight it, let root have an alias */ nodes.put("", root); nodes.put(rootZookeeper, root); /** add the proc node and quota node */ root.addChild(procChildZookeeper); nodes.put(procZookeeper, procDataNode); procDataNode.addChild(quotaChildZookeeper); nodes.put(quotaZookeeper, quotaDataNode); addConfigNode(); nodeDataSize.set(approximateDataSize()); try { dataWatches = WatchManagerFactory.createWatchManager(); childWatches = WatchManagerFactory.createWatchManager(); } catch (Exception e) { LOG.error("Unexpected exception when creating WatchManager, " + "exiting abnormally", e); System.exit(ExitCode.UNEXPECTED_ERROR.getValue()); } }
nodeDataSize.set(approximateDataSize());
@Test public void testCachedApproximateDataSize() throws Exception { DataTree dt = new DataTree(); long initialSize = dt.approximateDataSize(); Assert.assertEquals(dt.cachedApproximateDataSize(), dt.approximateDataSize()); // create a node dt.createNode("/testApproximateDataSize", new byte[20], null, -1, 1, 1, 1); dt.createNode("/testApproximateDataSize1", new byte[20], null, -1, 1, 1, 1); Assert.assertEquals(dt.cachedApproximateDataSize(), dt.approximateDataSize()); // update data dt.setData("/testApproximateDataSize1", new byte[32], -1, 1, 1); Assert.assertEquals(dt.cachedApproximateDataSize(), dt.approximateDataSize()); // delete a node dt.deleteNode("/testApproximateDataSize", -1); Assert.assertEquals(dt.cachedApproximateDataSize(), dt.approximateDataSize()); } }
print("approximate_data_size", zkdb.getDataTree().approximateDataSize());
print("approximate_data_size", zkdb.getDataTree().approximateDataSize());
public long approximateDataSize() { return dataTree.approximateDataSize(); }
@Override public double get() { return zkServer.getZKDatabase().getDataTree().approximateDataSize(); } }).register();
@Override public double get() { return zkServer.getZKDatabase().getDataTree().approximateDataSize(); } }).register();