void killSession(long session, long zxid) { // the list is already removed from the ephemerals // so we do not have to worry about synchronizing on // the list. This is only called from FinalRequestProcessor // so there is no need for synchronization. The list is not // changed here. Only create and delete change the list which // are again called from FinalRequestProcessor in sequence. Set<String> list = ephemerals.remove(session); if (list != null) { for (String path : list) { try { deleteNode(path, zxid); if (LOG.isDebugEnabled()) { LOG .debug("Deleting ephemeral node " + path + " for session 0x" + Long.toHexString(session)); } } catch (NoNodeException e) { LOG.warn("Ignoring NoNodeException for path " + path + " while removing ephemeral for dead session 0x" + Long.toHexString(session)); } } } }
void killSession(long session, long zxid) { // the list is already removed from the ephemerals // so we do not have to worry about synchronizing on // the list. This is only called from FinalRequestProcessor // so there is no need for synchronization. The list is not // changed here. Only create and delete change the list which // are again called from FinalRequestProcessor in sequence. HashSet<String> list = ephemerals.remove(session); if (list != null) { for (String path : list) { try { deleteNode(path, zxid); if (LOG.isDebugEnabled()) { LOG .debug("Deleting ephemeral node " + path + " for session 0x" + Long.toHexString(session)); } } catch (NoNodeException e) { LOG.warn("Ignoring NoNodeException for path " + path + " while removing ephemeral for dead session 0x" + Long.toHexString(session)); } } } }
@Test public void testPzxidUpdatedWhenDeletingNonExistNode() throws Exception { DataNode root = dt.getNode("/"); long currentPzxid = root.stat.getPzxid(); // pzxid updated with deleteNode on higher zxid long zxid = currentPzxid + 1; try { dt.deleteNode("/testPzxidUpdatedWhenDeletingNonExistNode", zxid); } catch (NoNodeException e) { /* expected */ } root = dt.getNode("/"); currentPzxid = root.stat.getPzxid(); Assert.assertEquals(currentPzxid, zxid); // pzxid not updated with smaller zxid long prevPzxid = currentPzxid; zxid = prevPzxid - 1; try { dt.deleteNode("/testPzxidUpdatedWhenDeletingNonExistNode", zxid); } catch (NoNodeException e) { /* expected */ } root = dt.getNode("/"); currentPzxid = root.stat.getPzxid(); Assert.assertEquals(currentPzxid, prevPzxid); }
tree.deleteNode(ZooDefs.CONFIG_NODE, 1); tree.getReferenceCountedAclCache().aclIndex = 0;
DeleteTxn deleteTxn = (DeleteTxn) txn; rc.path = deleteTxn.getPath(); deleteNode(deleteTxn.getPath(), header.getZxid()); break; case OpCode.reconfig:
DeleteTxn deleteTxn = (DeleteTxn) txn; rc.path = deleteTxn.getPath(); deleteNode(deleteTxn.getPath(), header.getZxid()); break; case OpCode.setData:
@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()); } }
void killSession(long session, long zxid) { // the list is already removed from the ephemerals // so we do not have to worry about synchronizing on // the list. This is only called from FinalRequestProcessor // so there is no need for synchronization. The list is not // changed here. Only create and delete change the list which // are again called from FinalRequestProcessor in sequence. HashSet<String> list = ephemerals.remove(session); if (list != null) { for (String path : list) { try { deleteNode(path, zxid); if (LOG.isDebugEnabled()) { LOG .debug("Deleting ephemeral node " + path + " for session 0x" + Long.toHexString(session)); } } catch (NoNodeException e) { LOG.warn("Ignoring NoNodeException for path " + path + " while removing ephemeral for dead session 0x" + Long.toHexString(session)); } } } }
DeleteTxn deleteTxn = (DeleteTxn) txn; debug = "Delete transaction for " + deleteTxn.getPath(); deleteNode(deleteTxn.getPath(), header.getZxid()); break; case OpCode.setData: