Curator's transaction is a wrapper around the normal ZooKeeper transaction 
feature. The ZK docs are not great on this: 
https://zookeeper.apache.org/doc/r3.4.6/api/org/apache/zookeeper/ZooKeeper.html#multi(java.lang.Iterable)
 
<https://zookeeper.apache.org/doc/r3.4.6/api/org/apache/zookeeper/ZooKeeper.html#multi(java.lang.Iterable)>

The TL;DR is that a ZooKeeper "transaction" is a set of batch modifications 
that are committed as one transaction (via 1 API call). It's nothing like an 
RDBMS transaction so your example won't work. 
> If not, can I achieve a consistent read of all the data in a path by some 
> other means?

ZooKeeper is an eventually consistent system. It is not possible to achieve 
RDBMS levels of consistency. ZK clients can potentially read old data if the 
instance you are connected to hasn't yet been updated. Further, I'd say that ZK 
is not a data store. It's a distributed consistency manager. If you are looking 
for a consistent (or semi-consistent) key-value store you should use a 
different technology.
-Jordan

> On Mar 22, 2017, at 1:20 AM, Neil Moore <[email protected]> wrote:
> 
> Does a curator transaction isolate me from changes in the underlying data? 
> E.g. if I do
> 
> CuratorTransaction transaction = curator.inTransaction();
> curator.getChildren().forPath(entityPath);
> curator.getData()...
> etc.
> 
> will forPath() and getData() operate on the same underlying data irrespective 
> of concurrent modifications elsewhere?
> If not, can I achieve a consistent read of all the data in a path by some 
> other means?
> Thanks 
> Neil
> 

Reply via email to