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 60839D0B3 for ; Thu, 15 Nov 2012 22:14:09 +0000 (UTC) Received: (qmail 20280 invoked by uid 500); 15 Nov 2012 22:14:08 -0000 Delivered-To: apmail-zookeeper-user-archive@zookeeper.apache.org Received: (qmail 20239 invoked by uid 500); 15 Nov 2012 22:14:08 -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 20227 invoked by uid 99); 15 Nov 2012 22:14:08 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Nov 2012 22:14:08 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of ted.dunning@gmail.com designates 74.125.83.42 as permitted sender) Received: from [74.125.83.42] (HELO mail-ee0-f42.google.com) (74.125.83.42) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Nov 2012 22:14:01 +0000 Received: by mail-ee0-f42.google.com with SMTP id t10so1180439eei.15 for ; Thu, 15 Nov 2012 14:13:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=4N4JkymIjdRkvYHcrBlpeuuQtO9WlSdE10QOHYgRa/8=; b=RLaIEfW9h5FDHXCmaGlLW35uwcUELdRjs6JGf71108U90BtmkukwzH3xf8u4j/1PKA HUthJJunvYCfZ84w2aEBtN/kSn3pmrK3tCmUe5H4n7ySV41Hz7frWLFli+i8Er/Fp/rJ fKeTacpdrcaE0Ab5KkSNcVJaW8l9uS42v0c802sPpMPmjAYcM6hwaegvbtPcX/l5F6eO HjAF38YRFB+H1kIQoALjGczofHQQxToMb+/YQmv4w2lOmhSf2OBjGWNeYXmgHbaPhFA9 fqDp/KDI2fhUz+jvfEMXjPdUNKOmU1c/oJxhi00C/xsChGI8Xaiz5I+GUA9SoxS9Pn5m OylQ== Received: by 10.14.205.3 with SMTP id i3mr7795046eeo.18.1353017621518; Thu, 15 Nov 2012 14:13:41 -0800 (PST) MIME-Version: 1.0 Received: by 10.223.74.89 with HTTP; Thu, 15 Nov 2012 14:13:11 -0800 (PST) In-Reply-To: References: <6676F52799F9C44DBF8499B1692393D02ECCD285@BL2PRD0411MB398.namprd04.prod.outlook.com> From: Ted Dunning Date: Thu, 15 Nov 2012 14:13:11 -0800 Message-ID: Subject: Re: 'Move' operation for Zookeeper To: user@zookeeper.apache.org Content-Type: multipart/alternative; boundary=047d7b34392eb4996604ce8ff670 X-Virus-Checked: Checked by ClamAV on apache.org --047d7b34392eb4996604ce8ff670 Content-Type: text/plain; charset=UTF-8 In particular, you can do something like this contents, version = get(x/y/z) multi([delete(x/y/z, version), create(a/b/c, contents)]) The multi will fail if x/y/z has been updated between the get and the multi. The multi will also fail if a/b/c cannot be created. If the multi succeeds, x/y/z will not exist and a/b/c will have the former content. If the multi fails, nothing will change. You would want to repeat this until it succeeds. This is ugly only in that you have to repeat it until it succeeds and in that the data has to make a round trip to the client and back. The second should be less of an issue if you remember that Zookeeper is a coordination service rather than a data storage system. On Thu, Nov 15, 2012 at 12:02 PM, Camille Fournier wrote: > You can simulate this using multi transactions in the current system. I > think the transactionality of move in the way you are suggesting breaks > down to a multi transaction, so implementing it as a special api call may > be considered redundant. > > C > > On Thu, Nov 15, 2012 at 2:14 PM, Robin Bate Boerop < > robin.bateboerop@userevents.com> wrote: > > > Zookeeper users, > > > > Has anyone investigated the implementation of a 'move' operation in > > Zookeeper? > > > > For example, suppose that a node '/x/y/z' has 50 Ko of data associated > > with it. A client wants the same data to be found only in node '/a/b/c'. > > The client must: > > 1. Get the contents of '/x/y/z', incurring a transfer of the 50 Ko of > data > > from ZK. > > 2. Create node '/a/b/c' with the same 50 Ko of data, incurring another > > transfer of it. > > 3. Delete node '/x/y/z'. > > > > It would be simpler to issue a 'move' command: move('/x/y/z', '/a/b/c'). > > This would also be much faster. > > > > -- > > Robin Bate Boerop > > > --047d7b34392eb4996604ce8ff670--