Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Plain View
Zookeeper >> mail # user >> Multi question on using previous ops results


+
Joe Gamache 2012-05-16, 15:59
Copy link to this message
-
Re: Multi question on using previous ops results
It looks like you are assuming that the versions of two znodes are synchronized. That seems pretty dangerous.

What is the higher level intent here?  Would it better to simply build a multi to update both znodes?

Sent from my iPhone

On May 16, 2012, at 11:59 AM, Joe Gamache <[EMAIL PROTECTED]> wrote:

> I need to do something like the following:
>
> Stat stats = nodeToSet.getStat();
> if (stats != null) {
>    int version = stats.getVersion();
>    stats = client.getZk().setData(path, data, version);
>
> (data was preset in code not shown).   Since I have multiple processes all vying to do things, in the worst case (which happens too frequently), two processes execute the above at basically the same time, which causes errors.   I thought I might be able to use Multi to do this atomically, but I cannot figure out how to use the result (the version number above) from one Op in a later Op.  Is this possible?
>
> This was the simplest example I could find, but this happens often - usually with Paths.  For instance, sometimes I create a zookeeper node and want a "LOCK" node underneath it.  If I follow the "recipe" and use an ephemeral sequential node as the lock, how can I refer to sequence in a Path in subsequent Op added to a "multi" or is there any way to do it atomically?  Sorry that was so very wordy.  What I was really trying to ask, is how do I create and lock a node atomically?
>
> thanks for any help, insight!
>
> joe
>
+
Joe Gamache 2012-05-17, 00:06
+
Joe Gamache 2012-05-18, 15:43
+
Ted Dunning 2012-05-18, 16:46
+
Joe Gamache 2012-05-18, 17:55
+
Ted Dunning 2012-05-19, 00:03
+
Joe Gamache 2012-05-20, 12:39
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB