Return-Path: X-Original-To: apmail-curator-user-archive@minotaur.apache.org Delivered-To: apmail-curator-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3994217FDC for ; Tue, 27 Jan 2015 17:24:14 +0000 (UTC) Received: (qmail 78121 invoked by uid 500); 27 Jan 2015 17:24:14 -0000 Delivered-To: apmail-curator-user-archive@curator.apache.org Received: (qmail 78080 invoked by uid 500); 27 Jan 2015 17:24:14 -0000 Mailing-List: contact user-help@curator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@curator.apache.org Delivered-To: mailing list user@curator.apache.org Received: (qmail 78068 invoked by uid 99); 27 Jan 2015 17:24:14 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Jan 2015 17:24:14 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW X-Spam-Check-By: apache.org Received-SPF: error (athena.apache.org: local policy) Received: from [209.85.192.170] (HELO mail-pd0-f170.google.com) (209.85.192.170) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Jan 2015 17:24:07 +0000 Received: by mail-pd0-f170.google.com with SMTP id p10so20069674pdj.1 for ; Tue, 27 Jan 2015 09:23:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:message-id:in-reply-to:references :subject:mime-version:content-type; bh=HgNGuPvecXVM4JiqEBTwBN7F4wywbJ4+I7ltCCQ1v7M=; b=OUZ/RRGoABF3+2rDWj+yaKMlkaC88rv4NFwalAbHWO36vJwkmdME70XUh/sk6Z5JFg dxVwQ+DOSLXae6rycghtpENQeqGhON8sc85OWvT2bH4rO5xhaNjGbBRfTupuusS5fYIJ rPGLJ1+F1NGnQrEuIsC70x2pTPtOC3kd1Gs3ed+2FPIKSAL0l2c2nL/9a0ZS6Uf5CXqg WDdWaCRqhMaQoivnXvPMKro6IVDGvcZ9j1YOfXtuSMKFjslyjmpnh8pc/7I2PCmr6+Ov mh/uXR1UCtoTcWtHl87yuCefYrX+t1BlMsooko2cRPHRrjzuPKLIp7UXZXGbclBoSddZ HOew== X-Gm-Message-State: ALoCoQmfqeNzOVnVCLPVhgxeJ8zNGjIVsIw/bw00R5BSdFFdNBNgz21g8h/EujhbV2WFNMG7XaYO X-Received: by 10.66.227.136 with SMTP id sa8mr3890939pac.110.1422379407001; Tue, 27 Jan 2015 09:23:27 -0800 (PST) Received: from Jordans-MacBook-Pro.local ([190.141.38.38]) by mx.google.com with ESMTPSA id zb8sm2175257pac.45.2015.01.27.09.23.24 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 27 Jan 2015 09:23:26 -0800 (PST) Date: Tue, 27 Jan 2015 12:23:22 -0500 From: Jordan Zimmerman To: Ricardo Ferreira , user@curator.apache.org Message-ID: In-Reply-To: References: Subject: Re: Regarding leadership status X-Mailer: Airmail (286) MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="54c7c98a_327b23c6_13d" X-Virus-Checked: Checked by ClamAV on apache.org --54c7c98a_327b23c6_13d Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline The process of leadership loss due to network issues is this: * The current leader's ZooKeeper client will try to send its heartbeat * The send will fail due to network failure * The ZK client will pass=C2=A0KeeperState.Disconnected and cause Curator= to go into SUSPENDED mode. Any users of leader selectors, etc. should se= e this and consider themselves no longer leader * Because the heartbeat is 2/3 of a session, there will be no other leade= r at this point * After session expiration, the ZK server will delete the ephemeral node = and cause the process of leader selection, etc. So, as you can see, if you properly monitor the connection state you neve= r have to worry about proper leadership. -Jordan On January 27, 2015 at 4:21:40 AM, Ricardo =46erreira (ricardojsfer=40gma= il.com) wrote: Hello all, I'm using Zookeeper (through Curator) for leadership election on an appli= cation I'm currently developing. Some operations can only be written by one of the members of the cluster,= so I'm using a node's leadership status to this effect.=C2=A0 =46or example, let's say a message arrives to all nodes but only one shou= ld do something about it. What I do is to check if the node is leader (through LeaderSelector=23hasLeadership= ()), and if it is then it does whatever it needs to do with the message. If it's not, it simply ignores it. My question is this: How can I be sure a node really is=C2=A0the leader=3F= What if the leader node is actually down but this hasn't been detected by Zookeeper yet=3F Then the non-leader nodes w= ill ignore the message and it will=C2=A0 never be processed. How is this usually dealt with=3F Regards --54c7c98a_327b23c6_13d Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline