Hi all,

I'm developing a library of primitives backed by ZooKeeper. An issue I've
recently hit is that you can only add children to persistent nodes.

When you're creating primitives for things like locking - for use for exampe
synchronizing cluster-wide processing of a NOSQL database like Cassandra -
this is a real pain:

1/ If a node crashes or something else goes wrong, you leave behind
persistent nodes. Over time these will grow and grow, rather like the old
tmp folders used to fill with files under Windows

2/ Persistent nodes = nasty scalability *bottleneck* because you're actually
having to write to disk somewhere.

To avoid this I'm actually thinking of writing locking system where you work
out the existing chain not by enumerating sequential children, but by
looking at the contents of each temporary lock node to see what it is
waiting on. But... that's quite horrible. Was wondering whether there is
some technical reason why you ephemeral nodes can't have children??

Otherwise it is aceptable e.g.

ZkPath ensurePath = new ZkPath("/Starburst/cluster/nodes",
CreateMode.PERSISTENT);
ensurePath.waitSynchronized();
clusterMembers = new ZkDistributedSet("/Starburst/cluster/nodes", new
String[] { thisNodeEndPoint }, true);
clusterMembers.addChangeListener(clusterNodesChangedProcessor, true);
clusterMembers.waitSynchronized();

Best, Dominic
ria101.wordpress.com

Reply via email to