From user-return-12116-archive-asf-public=cust-asf.ponee.io@zookeeper.apache.org Tue Sep 3 18:26:47 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 400B0180637 for ; Tue, 3 Sep 2019 20:26:47 +0200 (CEST) Received: (qmail 6413 invoked by uid 500); 3 Sep 2019 21:02:41 -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 6401 invoked by uid 99); 3 Sep 2019 21:02:40 -0000 Received: from Unknown (HELO mailrelay1-lw-us.apache.org) (10.10.3.159) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Sep 2019 21:02:40 +0000 Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.52]) by mailrelay1-lw-us.apache.org (ASF Mail Server at mailrelay1-lw-us.apache.org) with ESMTPSA id E624959D9 for ; Tue, 3 Sep 2019 18:26:45 +0000 (UTC) Received: by mail-ed1-f52.google.com with SMTP id g24so19449322edu.3 for ; Tue, 03 Sep 2019 11:26:45 -0700 (PDT) X-Gm-Message-State: APjAAAXt6QPNTctptjHTJwqSvhz+EmVZ/PGjVJ94W3uucM3v1WM8LuTx vdowgfOv3DfjS7aqs+6Z3zd9mvTaaY//SykOxqI= X-Google-Smtp-Source: APXvYqwOtnJWg5UWjKf59i4HgkGmZMIDlcJhSRmVsY3m4CLTa1aXOMNg3kh72PbBQvw5IDcLcVB4y/xS7X01wIos0xU= X-Received: by 2002:a17:906:bc2:: with SMTP id y2mr30275358ejg.148.1567535205167; Tue, 03 Sep 2019 11:26:45 -0700 (PDT) MIME-Version: 1.0 References: <5d6c835a.1c69fb81.9ff1c.d4f3SMTPIN_ADDED_BROKEN@mx.google.com> In-Reply-To: From: Michael Han Date: Tue, 3 Sep 2019 11:26:33 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: a misunderstanding of ZAB To: user@zookeeper.apache.org Content-Type: multipart/alternative; boundary="00000000000013b8940591aa3bee" --00000000000013b8940591aa3bee Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable +1 with what Alex has said. The commit case is easy to understand. For skip case, think this example: old quorum: F1 F2 F3 F4 F5, with F1 as L1. L1 has p on F1 and F2. new quorum: F1 F2 F3 F4 F5, with F3 as L2. It's possible, because although F1 and F2 has latest zxid, they could be partitioned away and F3 F4 F5 are enough to form quorum to elect a new leader. Now partition healed, the commit of p on F1 and F2 should be dropped (in ZK, this is what "TRUNC" sync is for). >> L2 become new leader, he should skip p1. If your L2 is F2 here, p1 will not be skipped, since p1 is available on F2 the new leader. On Tue, Sep 3, 2019 at 10:35 AM Alexander Shraer wrote: > In case2, it is possible that p1 is committed or dropped. It depends on > whether L2 knows about p1. > Note that L2 needs the support of a quorum to become leader, and in ZK > since there is no state copy from followers to leader, the leader candida= te > needs to have the longest log. > So, if L2's log includes p1 it will be committed otherwise it will be > dropped. > > In case1 L2's log necessarily includes p1 since it is present at a quorum > and without having it in the log its not possible to have a log more > up-to-date than that of a quorum / get the support of a quorum to become > leader. > > Alex > > > On Tue, Sep 3, 2019 at 4:52 AM Norbert Kalmar > > wrote: > > > Hi, > > > > That's a good question. So if I understand correctly, you are asking wh= at > > happens if there is a new Leader Election in ZooKeeper, what is the "la= st > > seen zxid". I checked the ZAB protocol, it is not entirely clear for me > as > > well, but my understanding is that the last seen zxid is the last > > transaction, which is read from txnlogs in case of a recovery. Honestly= , > > there's nothing else this could be read from. So if it hasn't been > > committed to the datatree (and that exists in memory anyway, at least > until > > a snapshot is taken), it is still the last txn that is logged by one of > the > > followers, so he will win the Leader Election, and the followers will g= et > > this txn as well. > > Anyone agree/disagree? :) > > > > Regards, > > Norbert > > > > On Mon, Sep 2, 2019 at 4:50 AM 121476721@qq.com <121476721@qq.com> > wrote: > > > > > hi, i'm a new to zookeeper, and this problem confuses me for nearly t= wo > > > months... > > > papers tell me that zab must satisfy: > > > A message delivered by one sever must be delivered on quorum. > > > A message skipped must always be skipped. > > > Then consider two cases below, L is short for leader, F is short for > > > follower, p is short for proposal. > > > Case1: > > > L send p1 to F2 F3 F4 F5. > > > F2 F3 ack p1, reach a quorum. > > > L1 is about to send commit but failed... > > > L2 become new leader, he should commit. > > > > > > Case2: > > > L1 send p1 to F2 F3 F4 F5. > > > Only F2 ack p1, not reach a quorum. > > > Then L1 failed... > > > L2 become new leader, he should skip p1. > > > > > > i think L2 should handle the cases in election&recovery phase. but ho= w > L2 > > > can know the global state and decide if commit p1 or skip p1=EF=BC=9F > > > if anyone helps, i will be much appreciate. > > > > > > > > > > > > 121476721@qq.com > > > > > > --00000000000013b8940591aa3bee--