Return-Path: X-Original-To: apmail-zookeeper-user-archive@www.apache.org Delivered-To: apmail-zookeeper-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C256DE551 for ; Wed, 13 Mar 2013 16:44:35 +0000 (UTC) Received: (qmail 12206 invoked by uid 500); 13 Mar 2013 16:44:35 -0000 Delivered-To: apmail-zookeeper-user-archive@zookeeper.apache.org Received: (qmail 12156 invoked by uid 500); 13 Mar 2013 16:44:34 -0000 Mailing-List: contact user-help@zookeeper.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@zookeeper.apache.org Delivered-To: mailing list user@zookeeper.apache.org Received: (qmail 12144 invoked by uid 99); 13 Mar 2013 16:44:34 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Mar 2013 16:44:34 +0000 X-ASF-Spam-Status: No, hits=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_PASS,UNPARSEABLE_RELAY X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [98.136.218.208] (HELO nm7-vm1.bullet.mail.gq1.yahoo.com) (98.136.218.208) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 13 Mar 2013 16:44:27 +0000 Received: from [98.137.12.60] by nm7.bullet.mail.gq1.yahoo.com with NNFMP; 13 Mar 2013 16:44:06 -0000 Received: from [98.136.44.54] by tm5.bullet.mail.gq1.yahoo.com with NNFMP; 13 Mar 2013 16:44:06 -0000 Received: from [127.0.0.1] by smtp109.prem.mail.sp1.yahoo.com with NNFMP; 13 Mar 2013 16:44:06 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1363193046; bh=r+vdCFgPTGuPoqzPY+v0jN8AgfNJ+ZUCFh3jy9j7hds=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:Content-Transfer-Encoding; b=v6iSbDDjSgVB89rrLoZwMvu5mmuz02DD2gP/hD4zQ50eLigbTjy2h0KzsfNuSIawQ377XgzvN19LPziJsn+v1rtE0Jd0shEgh/qLswBpJCYNFjPzG3voAh1EP9LgTHqsqT4U27zSBfmHc0Huhm2lEFsEBCFzKsLcjnacYQHO3ls= X-Yahoo-Newman-Id: 804442.20031.bm@smtp109.prem.mail.sp1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: ZHXRJa8VM1kqxpOquG5E1YgfPQASAgaYbr7rD3eJcPWI1t3 5JFdreVSSv80W88N2UA_7iCtXPOj_1LywGZcjhF.B_i6qy.vrdOCBReuTkvW JzCEENYfaUeGjvxWoxghBgaAr4kiPL7g0RUyLsfLA4S4UBfRGloPhWNnVgR7 d_twynFhM0rzV89a5xsQd5TCy9kRuQs1IfWE2DaIn.VNTWkMwN2MYLgActeZ 9YKtg9vIqoLLWlPn5HfF9DIZugko02sLDXPNiCiDQ2t_93rOIlOdmHyXxK9n P_sCI_Z1wvPoXPUm0BOSaOR0taBLFmz1nXt2bHmKRFKTKc1JCNku670hrXhA zEWEu7iwbKEzkGHztdsbj7N5Lj9OOmcvmoLnoFRybEucmo_yeWc4Mz73zcS5 9yJ5LLImM0VK0n6iI8KqVnWaxWqROj5CYHCR9IvJcIU9r3.tqIur3g6reytP k.vCS1Dc- X-Yahoo-SMTP: ZvR6Aa.swBBi9aze9_P4M914Ag-- Received: from netbook.local (vborky@76.103.130.241 with plain) by smtp109.prem.mail.sp1.yahoo.com with SMTP; 13 Mar 2013 09:44:06 -0700 PDT Message-ID: <5140ACD7.7010607@yahoo.com> Date: Wed, 13 Mar 2013 09:44:07 -0700 From: Vinayak Borkar User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130216 Thunderbird/17.0.3 MIME-Version: 1.0 To: user@zookeeper.apache.org Subject: Op.Check in ZooKeeper.multi and cversion Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Hi, I have a case where I need to create a new node (N) as a child of a node (P) only if the existing set of children satisfies a certain condition. In my code I was planning to fetch the list of children (along with the parent's cversion), verify if the condition on the existing set of children allows me to add a new node, and then in a multi() invocation create a child only if the cversion of the parent is the same as what I had witnessed before. However, I see that the Op.Check operation only allows me to check the data version of a node and not the cversion. I see that a slightly more expensive work-around would be to make sure that every mutation that adds or removes children to/from P also makes a data change to P so that I maintain the invariant that cversion == version for P and then just use Op.Check. Is there a better way to solve my problem? Thanks, Vinayak