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 372DA1050D for ; Tue, 4 Mar 2014 20:26:17 +0000 (UTC) Received: (qmail 74538 invoked by uid 500); 4 Mar 2014 20:26:15 -0000 Delivered-To: apmail-zookeeper-user-archive@zookeeper.apache.org Received: (qmail 74427 invoked by uid 500); 4 Mar 2014 20:26:15 -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 74419 invoked by uid 99); 4 Mar 2014 20:26:15 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Mar 2014 20:26:15 +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 (athena.apache.org: domain of cf@renttherunway.com designates 209.85.217.178 as permitted sender) Received: from [209.85.217.178] (HELO mail-lb0-f178.google.com) (209.85.217.178) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Mar 2014 20:26:11 +0000 Received: by mail-lb0-f178.google.com with SMTP id s7so31212lbd.23 for ; Tue, 04 Mar 2014 12:25:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=lW5Et683IwOH2KzE3Jw7FvkvUZgrsTYXypkZLvepZA0=; b=R8dw2f8nnVrT5hUkKxbdupcKrmVPAUjbwxEzzi5hhF/8O+39HHVNGl+cXUjDxESYwm 4l7vf7tMDyYsK8TmK9Gd3c9ZrwomNc8eNMj7OD5/lgYR5pYL9mGurI1Dr897oexd1j7X IEvjJ1/1CNsG6GGvYjOKCL1WsPgdC3fwlpNYPJFUhfNUZWTjWXtPItHMr9KrzuPBwhJF fqsRCQe9DhGX+3VA2kQZraCR2BP2kKLFIw6Hlxjy9bXnJkeh/7Y8MA5zSQnbywF4xjQz ihmzBJSRxfH3gpqZsBc7HI+hHkhPJS3mky0+VHRR2URYtudXwZ5ycs9rUBFtv77BDtVe bjrA== X-Gm-Message-State: ALoCoQn3iEyFtOYjwlGdJMVn7vaoU2yRyGTJIhVMFHQMBDSai4B1/556ktROjO7YgCRmsUo4Pcoj MIME-Version: 1.0 X-Received: by 10.152.218.103 with SMTP id pf7mr794843lac.40.1393964749207; Tue, 04 Mar 2014 12:25:49 -0800 (PST) Sender: cf@renttherunway.com Received: by 10.112.155.2 with HTTP; Tue, 4 Mar 2014 12:25:49 -0800 (PST) In-Reply-To: References: Date: Tue, 4 Mar 2014 15:25:49 -0500 X-Google-Sender-Auth: ioinHRUtexx14aJIznLucB7uIqw Message-ID: Subject: Re: sometimes I can't read data I just wrote..race condition or misunderstanding? From: Camille Fournier To: "bookkeeper-user@zookeeper.apache.org" Content-Type: multipart/alternative; boundary=001a1136c856b4c9f004f3cdb536 X-Virus-Checked: Checked by ClamAV on apache.org --001a1136c856b4c9f004f3cdb536 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Is the same client issuing the write and the read? If so, you should see the data you wrote. Otherwise, you may be connected to a lagging client, as Raul says. C On Tue, Mar 4, 2014 at 3:22 PM, Ra=C3=BAl Guti=C3=A9rrez Segal=C3=A9s wrote: > On 4 March 2014 07:21, Brian Tarbox wrote: > > > We're running a five node cluster in AWS and sometimes if I do a read > > immediately after doing a write ZK does not find the data I just wrote. > > > > I may just have a flawed model but is this a case of "writes go to the > > master, while reads can go to any node in the cluster?". We are thinki= ng > > that perhaps our write went to the master and then our read went to a > > follower that hadn't gotten the write yet? > > > > Perhaps you can call sync() to ensure reads after writes? > > > > Along the same lines...when does a watch fire? After the leader has th= e > > change or after all followers have gotten the change? > > > > The pipeline is, in a poor's man diagram, as follow: > > > client =E2=86=92 write request =E2=86=92 zk_server_1 > =E2=86=93 > =E2=86=93 > write request is sent to the leader > =E2=86=93 > =E2=86=93 > leader fans out a transaction proposal to all followers > =E2=86=93 > =E2=86=93 > =E2=86=93 =E2=86=93 = =E2=86=93 > =E2=86=93 > follower 1 follower 2 follower 3 follower= 4 > =E2=86=93 > =E2=86=93 > followers, non-synchronously, acknowledge the proposal > =E2=86=93 > =E2=86=93 > when the leader gets a sufficient number of acks (from a "majority") > it fans out COMMIT msgs to followers > =E2=86=93 > =E2=86=93 > =E2=86=93 =E2=86=93 = =E2=86=93 > =E2=86=93 > follower 1 follower 2 follower 3 follower= 4 > =E2=86=93 > =E2=86=93 > followers will then apply the write which triggers watches, that i= n > turn will then flow to listening clients... > > > Hth, > -rgs > --001a1136c856b4c9f004f3cdb536--