​The only way to do this safely without ZOOKEEPER-1407 would be to do all
the reads and get the version of each path as you're doing the reads. Put a
corresponding Check() operation into a multi for each path you've read.
After you've read everything commit the multi. The Check() operation
doesn't modify the database in any way but allows you to verify that a
given path exists with ​an exact version number. Since a multi is a
transactional operation you'll be guaranteed that you have the most recent
versions of all those paths that you read...

At least that's how I'd solve this problem.

On Tue, May 12, 2015 at 10:58 PM, Patrick Hunt <[email protected]> wrote:

> Not that I know of. Perhaps by using an explicit zookeeper lock around the
> operations that you want to protect?
>
> Patrick
>
> On Mon, May 11, 2015 at 3:14 AM, Paolo Viotti <[email protected]>
> wrote:
>
> > Hi,
> >
> > I've noticed that read operations in Multi are not supported (although
> > they will be: https://issues.apache.org/jira/browse/ZOOKEEPER-1407 ), so
> > I was wondering: is there a suggested best practice / recipe for reading
> > atomically several znodes?
> >
> > Thanks,
> > Paolo
> >
>

Reply via email to