Return-Path: X-Original-To: apmail-curator-user-archive@minotaur.apache.org Delivered-To: apmail-curator-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 95F7517A90 for ; Thu, 2 Oct 2014 18:15:46 +0000 (UTC) Received: (qmail 6554 invoked by uid 500); 2 Oct 2014 18:15:46 -0000 Delivered-To: apmail-curator-user-archive@curator.apache.org Received: (qmail 6512 invoked by uid 500); 2 Oct 2014 18:15:46 -0000 Mailing-List: contact user-help@curator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@curator.apache.org Delivered-To: mailing list user@curator.apache.org Received: (qmail 6502 invoked by uid 99); 2 Oct 2014 18:15:46 -0000 Received: from minotaur.apache.org (HELO minotaur.apache.org) (140.211.11.9) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Oct 2014 18:15:46 +0000 Received: from localhost (HELO mail-lb0-f179.google.com) (127.0.0.1) (smtp-auth username vines, mechanism plain) by minotaur.apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Oct 2014 18:15:45 +0000 Received: by mail-lb0-f179.google.com with SMTP id l4so2761932lbv.10 for ; Thu, 02 Oct 2014 11:15:43 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.112.147.74 with SMTP id ti10mr453566lbb.29.1412273743968; Thu, 02 Oct 2014 11:15:43 -0700 (PDT) Reply-To: vines@apache.org Received: by 10.114.184.147 with HTTP; Thu, 2 Oct 2014 11:15:43 -0700 (PDT) Received: by 10.114.184.147 with HTTP; Thu, 2 Oct 2014 11:15:43 -0700 (PDT) In-Reply-To: References: Date: Thu, 2 Oct 2014 14:15:43 -0400 Message-ID: Subject: Re: Transaction question From: John Vines To: Benjamin Jaton Cc: user@curator.apache.org Content-Type: multipart/alternative; boundary=047d7b3a84bed5c34e0504749a14 --047d7b3a84bed5c34e0504749a14 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable In the set data iterator, there is a with version method you can use to set to guarantee the read-modify-write is uninterrupted. Sent from my phone, please pardon the typos and brevity. On Oct 2, 2014 1:39 PM, "Benjamin Jaton" wrote: > Hi Vines, I'm not sure I understand what you mean: > The only methods that will give you a stat object are getData() , exists(= ) > and getChildren(), how can I know the node hasn't been updated when I do = a > setData()? > > > On Thu, Sep 25, 2014 at 6:08 AM, John Vines wrote: > >> Another option is to use the Stat object so you can do a >> read-modify-write to guarantee that you're writing over the value you re= ad. >> >> On Wed, Sep 24, 2014 at 5:28 PM, Benjamin Jaton >> wrote: >> >>> It's more a "compare-and-set type operation" but on the same node. >>> I think I have to do a lock indeed. >>> >>> Thanks! >>> >>> On Wed, Sep 24, 2014 at 8:35 AM, Jordan Zimmerman < >>> jordan@jordanzimmerman.com> wrote: >>> >>>> There are no ZooKeeper APIs that will allow you to atomically check th= e >>>> value of a node and change another node based on that value. You=E2=80= =99d need to >>>> write a recipe for that. i.e. get a lock (InterProcessMutex), get the >>>> value, change another value, release the lock. >>>> >>>> -JZ >>>> >>>> >>>> On September 23, 2014 at 6:48:19 PM, Benjamin Jaton ( >>>> bjaton@radiantlogic.com) wrote: >>>> >>>> Hello, >>>> >>>> I would like to know if there is a way to get the value of a node, >>>> update it and save it, all in the same transaction. I have been lookin= g for >>>> a way to do that but no luck. >>>> Any idea? >>>> >>>> Thanks >>>> Ben >>>> >>>> >>> >> > --047d7b3a84bed5c34e0504749a14 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

In the set data iterator, there is a with version method you= can use to set to guarantee the read-modify-write is uninterrupted.

Sent from my phone, please pardon the typos and brevity.

On Oct 2, 2014 1:39 PM, "Benjamin Jaton&quo= t; <bjaton@radiantlogic.com> wrote:
Hi Vines, I'm not sure I understand what you mean:
= The only methods that will give you a stat object are getData() , exists() = and getChildren(), how can I know the node hasn't been updated when I d= o a setData()?

<= br>
On Thu, Sep 25, 2014 at 6:08 AM, John Vines <= span dir=3D"ltr"><= vines@apache.org> wrote:
Another option is to use the Stat object so you can do a rea= d-modify-write to guarantee that you're writing over the value you read= .

= On Wed, Sep 24, 2014 at 5:28 PM, Benjamin Jaton <bjaton@radiantlogic= .com> wrote:
It's more a "compare-and-set type operation" but on the sam= e node.
I think I have to do a lock indeed.

<= /span>
Thanks!

On Wed, Sep 24, 2014 at 8:35 AM, Jordan = Zimmerman <jordan@jordanzimmerman.com> wrote:
There are no ZooKeeper APIs that will allow you to a= tomically check the value of a node and change another node based on that v= alue. You=E2=80=99d need to write a recipe for that. i.e. get a lock (Inter= ProcessMutex), get the value, change another value, release the lock.
=

-JZ


<= p style=3D"color:#000">On September 23, 2014 at 6:48:19 PM, Benjamin Jaton = (bjaton@radian= tlogic.com) wrote:

=
Hello,

I would like to know if there is a way to get the value of a node, update it and save it, all in the same transaction. I have been looking for a way to do that but no luck.
Any idea?

Thanks
Ben



--047d7b3a84bed5c34e0504749a14--