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 1A0A39354 for ; Fri, 9 Mar 2012 11:09:28 +0000 (UTC) Received: (qmail 53866 invoked by uid 500); 9 Mar 2012 11:09:27 -0000 Delivered-To: apmail-zookeeper-user-archive@zookeeper.apache.org Received: (qmail 53841 invoked by uid 500); 9 Mar 2012 11:09:27 -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 53833 invoked by uid 99); 9 Mar 2012 11:09:27 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Mar 2012 11:09:27 +0000 X-ASF-Spam-Status: No, hits=-2.8 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_HI,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of Botond.Hejj@morganstanley.com designates 205.228.53.69 as permitted sender) Received: from [205.228.53.69] (HELO hqmtaint02.ms.com) (205.228.53.69) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Mar 2012 11:09:20 +0000 Received: from hqmtaint02.ms.com (localhost.ms.com [127.0.0.1]) by hqmtaint02.ms.com (output Postfix) with ESMTP id 8C4149F08ED for ; Fri, 9 Mar 2012 06:08:59 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=morganstanley.com; s=p20110615; t=1331291339; x=1332500939; bh=ipVChlPuQoA6dV+H5tOxnJ154TdEkvosB8oxCtvyt3w=; h=MIME-Version:Date:Message-ID:Subject:From:To:Content-Type; b=cPabULFaDzMqmHIhvUR1eqozD1hJLcRRJTY0IjVOSywaREMTWI2PoZb1o9v17hYY8 hoGudQHoVy8NAk076HK+HLMWu8+S9sfKLzkkW0uQiSz8vfiEZYnENA6UMwNslH3u2A 0VsrNt7bdWWOP9RtgKNtq/HuRE52TpG7jbEX6zTE= Received: from ny021bas02.ms.com (ny021bas02.ms.com [10.162.156.34]) by hqmtaint02.ms.com (internal Postfix) with ESMTP id 8A8539F08E3 for ; Fri, 9 Mar 2012 06:08:59 -0500 (EST) Received: from ny021bas02.ms.com (localhost [127.0.0.1]) by ny021bas02.ms.com (msa-out Postfix) with ESMTP id 729655405F for ; Fri, 9 Mar 2012 06:08:59 -0500 (EST) Received: from hqmsaext01.ms.com (hqmsaext01 [205.228.53.70]) by ny021bas02.ms.com (mta-in Postfix) with ESMTP id 701E1748034 for ; Fri, 9 Mar 2012 06:08:59 -0500 (EST) Received: from hqmsaext01.ms.com (localhost.ms.com [127.0.0.1]) by hqmsaext01.ms.com (output Postfix) with ESMTP id 621A3146CD5F for ; Fri, 9 Mar 2012 06:08:59 -0500 (EST) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com [209.85.217.169]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (verified OK)) by hqmsaext01.ms.com (submission Postfix) with ESMTPS id 26783146CCAA for ; Fri, 9 Mar 2012 06:08:59 -0500 (EST) Received: by lbbgf7 with SMTP id gf7so358846lbb.0 for ; Fri, 09 Mar 2012 03:08:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type :x-gm-message-state; bh=ipVChlPuQoA6dV+H5tOxnJ154TdEkvosB8oxCtvyt3w=; b=Ckh41Ckv7Qakz2vSpkTfikRWL7FPnhDP2drJLPUOuK5oDUM5jmCB4JzfdEHC/we3hR a9YeFbNjUWCE6mmDYlY5N/BSscP1f3MHobx2WlopuYJJvvtjgvzInuNRWcRdHrg6pfuc x1TlvgdQk7Kk30ECMUQZtn7T3Kiw97qkGahPV19zobKmgzcBdkJdMfuwCBEFzR7WKZRy A8yJ7ABnAUdJMELPUtu9FTuFg8802/bnPT7lzA/WPYYEQa/6oS3idAWx8uKy/mhTrfXd GQbC3wubF9Dnj8o4X414nVXltx9u+4vKB8QEHswNcbqUuAwDcKuQ6lZeW4Rp7Ea6LFIL GBbg== MIME-Version: 1.0 Received: by 10.152.147.202 with SMTP id tm10mr1391519lab.49.1331291337886; Fri, 09 Mar 2012 03:08:57 -0800 (PST) Received: by 10.112.38.195 with HTTP; Fri, 9 Mar 2012 03:08:57 -0800 (PST) Date: Fri, 9 Mar 2012 12:08:57 +0100 Message-ID: Subject: java client watches inconsistently triggered on reconnect From: Botond Hejj To: user@zookeeper.apache.org Content-Type: multipart/alternative; boundary=e89a8f235311498ccb04bacd6bd5 X-Gm-Message-State: ALoCoQk5uzzsaA4dtxaoeDMsIyWJUE2wO8yc+sd4dWKu5JgBo9fwX3p3xwsgivthehv+IwEwvRIs X-Virus-Checked: Checked by ClamAV on apache.org --e89a8f235311498ccb04bacd6bd5 Content-Type: text/plain; charset=ISO-8859-1 Hi, I've observed an inconsistent behavior in java client watches. The inconsistency relates to the behavior after the client reconnects to the zookeeper ensemble. The documentation is not completely clear for me on this but if I am not mistaken than after the client reconnects to the ensemble only those watches should trigger which should have been triggered also if the connections was not lost. This means if I watch for changes in node /foo and there is no change there than my watch should not be triggered on reconnecting to the ensemble. This is not always the case in the java client. I've debugged the issues and I could locate the case when the watch is always triggered on reconnect. This is consistently happening if I connect to a follower in the ensemble and I don't do any operation which goes through the leader. Looking at the code I see that the client stores the lastzxid and sends that with its request. This is 0 on startup and will be updated everytime from the server replies. This lastzxid is also sent to the server after reconnect together with watches. The server decides which watch to trigger based on this lastzxid probably because that should mean the last known state of the client. If this lastzxid is 0 than all the watches are triggered. I've checked why is this lastzxid 0. I thought it shouldn't be since there was already a request to the server to set the watch and in the reply the server could have sent back the zxid but it turns out that it sends just 0. Looking at the server code I see that for requests which doesn't go through the leader the follower server just sends back the same zxid that the client sent. Could anyone who is more familiar with the codebase comment on this. I think this is bug and doesn't seems to be a straightforward way to fix it. (I've done most of the tests with 3.3.3 server/client but this seems to be the case in other versions) Regards, Botond Hejj Morgan Stanley | Technology Lechner Odon fasor 8 | Floor 07 Budapest, 1095 Phone: +36 1 881-3962 Botond.Hejj@MorganStanley.com --e89a8f235311498ccb04bacd6bd5--