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 29D3018AE4 for ; Tue, 4 Aug 2015 21:11:34 +0000 (UTC) Received: (qmail 29288 invoked by uid 500); 4 Aug 2015 21:11:33 -0000 Delivered-To: apmail-zookeeper-user-archive@zookeeper.apache.org Received: (qmail 29239 invoked by uid 500); 4 Aug 2015 21:11:33 -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 29226 invoked by uid 99); 4 Aug 2015 21:11:32 -0000 Received: from Unknown (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Aug 2015 21:11:32 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 5522CDA6BD for ; Tue, 4 Aug 2015 21:11:32 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.898 X-Spam-Level: ** X-Spam-Status: No, score=2.898 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=3, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id xc9HfUMwAc4z for ; Tue, 4 Aug 2015 21:11:30 +0000 (UTC) Received: from mail-oi0-f47.google.com (mail-oi0-f47.google.com [209.85.218.47]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with ESMTPS id 35C8D267AF for ; Tue, 4 Aug 2015 21:11:30 +0000 (UTC) Received: by oip136 with SMTP id 136so9931711oip.1 for ; Tue, 04 Aug 2015 14:11:29 -0700 (PDT) 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=1Y5c3YGqWt/e8UhVNg2mqXYp1iKG5fdIuEy83Be0GE4=; b=Xen8lyR2Qm39BFVrg6gDubuO5mfxLg5vF9/UyvMcBA7AOZdQfiUi3NseL2cqa0DHm7 2KE2TpO+mdmwIoIV22vZLaU2AUmBshH+V9TjoTomMsjrLGhZJYhwcvj/EmjHxEZrOMZv QxySw6yIGQZeTFrQASJGsgcRdSYlUte9R94cbwYAptpuRZD++k6ci9VluS9FaEKGEN7q ge7HmXI2ZIgpJrABlODZEzwwy4okqpOi6p7mtaxlLHJiHT5zFPlFlwZihTyeXpA6lYi2 Lb1q6yDg8bEQBS9DRCFTCQ3mlHm4OYRcq17dYQdkqDTTb0U89iFpGCAfcSDTjV+7yoEj 0Fww== X-Received: by 10.202.98.130 with SMTP id w124mr4901758oib.29.1438722689558; Tue, 04 Aug 2015 14:11:29 -0700 (PDT) MIME-Version: 1.0 Received: by 10.202.195.17 with HTTP; Tue, 4 Aug 2015 14:11:10 -0700 (PDT) In-Reply-To: References: <2015080414393275398766@baidu.com> From: Alexander Shraer Date: Tue, 4 Aug 2015 14:11:10 -0700 Message-ID: Subject: Re: Doubts about libzookeeper To: "user@zookeeper.apache.org" Content-Type: multipart/alternative; boundary=001a113d307ed76f07051c82ba6d --001a113d307ed76f07051c82ba6d Content-Type: text/plain; charset=UTF-8 maybe 1 or 2 synctime, is enough given what you said about syncs - after 1 synctime we know that either server1 disconnected (and will have to bootstrap its state from the leader if it ever reconnects) or the request got to the leader. But since synctime may not be measured exactly from our request submission it maybe that 2 synctime are needed. Would need to look deeper into pings and synctime to tell for sure. On Tue, Aug 4, 2015 at 2:05 PM, Camille Fournier wrote: > That's true. I spent some time trying to think about when and how that > would be possible, and didn't get very far. We have guarantees about how > far out of sync a quorum member can be before it's booted, so I would think > that there's some way to timebound this potentially to prevent it, a la > your suggestion about 3X synctime. > > C > > > On Tue, Aug 4, 2015 at 4:58 PM, Alexander Shraer > wrote: > > > Yes, I checked and you're right. It gets queued at the leader until all > > previously proposed requests at the leader > > are committed. But still if the request is only on its way between > server 1 > > and the leader sync won't immediately help, right ? > > > > > > On Tue, Aug 4, 2015 at 11:39 AM, Camille Fournier > > wrote: > > > > > I thought that sync forced a flush of the queued events on a quorum > > member > > > before completing/got it in the path of events from the leader, so that > > it > > > won't return until all of the pending leader events before it have been > > > seen by this quorum member. Is that not correct? > > > > > > On Tue, Aug 4, 2015 at 2:20 PM, Alexander Shraer > > > wrote: > > > > > > > It seems that since the delete may be in-flight (between server 1 and > > > > leader, or still being proposed by the leader) > > > > when the client connects to server 2, doing a sync right a way may > not > > > help > > > > since the operation hasn't been committed yet. Perhaps the client > > should > > > > wait some multiple of synclimit time (3x ?) before invoking the sync > to > > > > allow the delete to commit or disappear for sure. This is all related > > to > > > > https://issues.apache.org/jira/browse/ZOOKEEPER-22, which is still > > open > > > > unfortunately... > > > > > > > > On Tue, Aug 4, 2015 at 10:15 AM, Camille Fournier < > camille@apache.org> > > > > wrote: > > > > > > > > > True, I'm not sure when the xid increments. If that is the case, > you > > > can > > > > > force a sync before the read of the path, to prevent reading stale > > > data. > > > > So > > > > > that would be the solve for that edge case although it's an > expensive > > > > > solve. > > > > > > > > > > C > > > > > > > > > > On Tue, Aug 4, 2015 at 12:52 PM, Alexander Shraer < > shralex@gmail.com > > > > > > > > wrote: > > > > > > > > > > > Hi Camille, > > > > > > > > > > > > if the client received a response for the delete then sure it > > > shouldn't > > > > > be > > > > > > able to connect > > > > > > to servers that didn't see it. But if it disconnected before > seeing > > > the > > > > > > response the example seems possible to me. > > > > > > I haven't checked the code to see when exactly the transaction > > number > > > > is > > > > > > incremented at > > > > > > the client, so I may be wrong, but suppose for example that > > > zkserver-1 > > > > > > crashes before > > > > > > sending the delete request to the leader. Then, the request is > gone > > > > > > forever. If you don't let the client > > > > > > connect to another server that hasn't seen the delete, the client > > > will > > > > > > never be able to connect. > > > > > > So it seems quite possible that it connects, then the request is > > > > executed > > > > > > (if zkserver-1 hasn't crashed > > > > > > after all) and the znode disappears. > > > > > > > > > > > > Alex > > > > > > > > > > > > > > > > > > On Tue, Aug 4, 2015 at 8:33 AM, Camille Fournier < > > camille@apache.org > > > > > > > > > > wrote: > > > > > > > > > > > > > ZooKeeper provides a session-coherent single system image > > > guarantee. > > > > > Any > > > > > > > request from the same session will see the results of all of > its > > > > > writes, > > > > > > > regardless of which server it connects to. See: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > http://zookeeper.apache.org/doc/r3.4.6/zookeeperProgrammers.html#ch_zkGuarantees > > > > > > > > > > > > > > So, if your session deletes, and the delete is successfully > > > processed > > > > > by > > > > > > > the quorum, you will not see the path that you have deleted no > > > matter > > > > > > what > > > > > > > server your session connects to. I believe in practice that > this > > > > means > > > > > > that > > > > > > > the ZK servers that might be behind your session (say server 2 > is > > > > > lagging > > > > > > > behind a few commits) will refuse to allow your session to > > connect > > > to > > > > > it, > > > > > > > so that you will not see stale data. > > > > > > > > > > > > > > This means that the example Lokesh gave: > > > > > > > > > > > > > > "1. Quorum leader has forwarded request to zkserver-2 for > "delete > > > > > /path". > > > > > > > 2. If your client connects to "zkserver-2" after step 1 is > > executed > > > > > (get > > > > > > > /path). Then your "/path" will not be available. > > > > > > > 3. If your client connects to "zkserver-2" before step1 is > > executed > > > > > (get > > > > > > > /path) then your "/path" would be available and after some time > > > your > > > > > path > > > > > > > would not be available (after zkserver-2 is synched with the > > > leader)" > > > > > > > > > > > > > > Cannot happen, so long as you are in the same session. > > > > > > > > > > > > > > C > > > > > > > > > > > > > > On Tue, Aug 4, 2015 at 6:49 AM, Lokesh Shrivastava < > > > > > > > lokesh.shrivastava@gmail.com> wrote: > > > > > > > > > > > > > > > I think it depends on whether your request reaches zkserver-1 > > and > > > > > > whether > > > > > > > > it is able to send the request to quorum leader. Considering > > that > > > > > > "delete > > > > > > > > /path" request has reached the quorum leader then following > may > > > > > happen > > > > > > > > > > > > > > > > 1. Quorum leader has forwarded request to zkserver-2 for > > "delete > > > > > > /path". > > > > > > > > 2. If your client connects to "zkserver-2" after step 1 is > > > executed > > > > > > (get > > > > > > > > /path). Then your "/path" will not be available. > > > > > > > > 3. If your client connects to "zkserver-2" before step1 is > > > executed > > > > > > (get > > > > > > > > /path) then your "/path" would be available and after some > time > > > > your > > > > > > path > > > > > > > > would not be available (after zkserver-2 is synched with the > > > > leader) > > > > > > > > > > > > > > > > Others can correct me if this is not how it works. > > > > > > > > > > > > > > > > Thanks. > > > > > > > > Lokesh > > > > > > > > > > > > > > > > On 4 August 2015 at 12:09, liangdong01@baidu.com < > > > > > > liangdong01@baidu.com> > > > > > > > > wrote: > > > > > > > > > > > > > > > > > Hi, > > > > > > > > > I'm thinking about a program desgin with libzookeeper, > > > here > > > > is > > > > > > my > > > > > > > > > doubts: > > > > > > > > > > > > > > > > > > 1) first, I connnect to zkserver-1, and there exists > the > > > path > > > > > > > > "/path". > > > > > > > > > 2) I sends "delete /path", the request reaches(may > not, i > > > > don't > > > > > > > know > > > > > > > > > about that) zkserver-1 and dont't know whether this > effected, > > > and > > > > > > then > > > > > > > > lost > > > > > > > > > connection before response returns. > > > > > > > > > 3) reconnect the same session to zkserver-2, and I > sends > > > > "get > > > > > > > > /path". > > > > > > > > > > > > > > > > > > which one will the "get /path" return possibly : > > > > > > > > > 1, "not exists" > > > > > > > > > 2, "exists" and "always exists" > > > > > > > > > 3, "exists" and "not exists" afterwards > > > > > > > > > > > > > > > > > > my biggist problem is wether the 3) will occur or not, > > > > thanks! > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > liangdong01@baidu.com > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > --001a113d307ed76f07051c82ba6d--