Return-Path: Delivered-To: apmail-hadoop-zookeeper-user-archive@minotaur.apache.org Received: (qmail 82338 invoked from network); 26 Mar 2009 02:28:44 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 26 Mar 2009 02:28:44 -0000 Received: (qmail 54087 invoked by uid 500); 26 Mar 2009 02:28:44 -0000 Delivered-To: apmail-hadoop-zookeeper-user-archive@hadoop.apache.org Received: (qmail 54069 invoked by uid 500); 26 Mar 2009 02:28:44 -0000 Mailing-List: contact zookeeper-user-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: zookeeper-user@hadoop.apache.org Delivered-To: mailing list zookeeper-user@hadoop.apache.org Received: (qmail 54059 invoked by uid 99); 26 Mar 2009 02:28:44 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 Mar 2009 02:28:44 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [68.142.207.100] (HELO web32003.mail.mud.yahoo.com) (68.142.207.100) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 26 Mar 2009 02:28:35 +0000 Received: (qmail 28595 invoked by uid 60001); 26 Mar 2009 02:28:12 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1238034492; bh=EVjpawtNgGKirlTWwJ/sU7I4BGpsdWfHJU993BjzgRI=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=qXNK9xd4ZF+ozHs3yzO7vMDpDPOGI0kXG+CxLZyOSmS4OvUa3uZuzW3VhOsXYHjRzEOlq37qrXDuC26hRz9IoZeEX70EGr5UiUjoiyga2+dA9HBKEf+zkDDWXMC0QylMrgYRmuW+CpMpEOw7l+jpuWQPtDfF3/euE00sT+u6+Co= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=xwISVs7RSoBYbAOUGj6NoWuBPq9nNhvmCY7tLh9GhBADSid+ZSp/FCHrcbVjv/agsxTE31V5Qtu4v9tXaEEUipaQzBY8nxVjAT6wYCNlrMet+8+l3ru+f9nbPN5P2Y1RujOLoDZXQ529i/ifZq0/8s2+UyrY7wtKI3EJaOECGK4=; Message-ID: <717101.27410.qm@web32003.mail.mud.yahoo.com> X-YMail-OSG: SyQq7JcVM1njNtERXkQbEVfrptdUrFRL_mKXvjE8uuAGRi952bIticby_9Nv7.X8D1FH3cs_sJO0.hZydJcPEGeOGU7q6KvD5y47xMV_DuKCdbVW.ZP7JvTFsSXDY9l_Aexrx_ZGwoEL_EkKEKF0_RM6My5qJmpuah_gypP2My6ZwPpt33NBDKM4OBrR Received: from [69.236.84.44] by web32003.mail.mud.yahoo.com via HTTP; Wed, 25 Mar 2009 19:28:12 PDT X-Mailer: YahooMailRC/1277.32 YahooMailWebService/0.7.289.1 Date: Wed, 25 Mar 2009 19:28:12 -0700 (PDT) From: "raghul@yahoo.com" Subject: Incorrect implementation of QuorumCnxManager.haveDelivered()? To: zookeeper-user@hadoop.apache.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Hello,=0A=0AI am a ZooKeeper newbie, so pardon me if I am repeating questio= ns that have been raised before.=0A=0AI believe the implementation of Quoru= mCnxManager.haveDelivered() is incorrect. If I understand correctly, queueS= endMap contains a queue of messages for each peer to which the local peer i= s trying to send election messages. When FastLeaderElection notices a timeo= ut while polling for inbound messages, it checks to see if all the messages= have been delivered by calling this function. So shouldn't this function a= ctually check each queue in the hash map and return true if all of them are= empty? This method is rather returning true the if just one of the queues = is empty?=0A=0A /**=0A * Check if all queues are empty, indicating t= hat all messages have been delivered.=0A */=0A boolean haveDelivered= () {=0A for (ArrayBlockingQueue queue : queueSendMap.val= ues()) {=0A LOG.debug("Queue size: " + queue.size());=0A = if (queue.size() =3D=3D 0)=0A return true;=0A }= =0A=0A return false;=0A }=0A=0AAlso, could someone expain the rea= son behind maitaining a queue of messages for each peer in queueSendMap? Wh= y do we need a per peer queue here? Since this is used during election, the= local peer is not sending more than one message at a time to the remote pe= er. So the hash map needs to store just one message per remote peer?=0A=0A-= Raghu=0A=0A=0A=0A