Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 1EDC4200C43 for ; Sun, 12 Mar 2017 01:17:11 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 1D55F160B88; Sun, 12 Mar 2017 00:17:11 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 661D5160B7B for ; Sun, 12 Mar 2017 01:17:10 +0100 (CET) Received: (qmail 65871 invoked by uid 500); 12 Mar 2017 00:17:07 -0000 Mailing-List: contact dev-help@curator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@curator.apache.org Delivered-To: mailing list dev@curator.apache.org Received: (qmail 65860 invoked by uid 99); 12 Mar 2017 00:17:07 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 12 Mar 2017 00:17:07 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id F31D9C028B for ; Sun, 12 Mar 2017 00:17:06 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.452 X-Spam-Level: * X-Spam-Status: No, score=1.452 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_NEUTRAL=0.652, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id ZTWAepVn_y9V for ; Sun, 12 Mar 2017 00:17:06 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 8990F5F3F0 for ; Sun, 12 Mar 2017 00:17:05 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id D6D04E0534 for ; Sun, 12 Mar 2017 00:17:04 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 5154E243A8 for ; Sun, 12 Mar 2017 00:17:04 +0000 (UTC) Date: Sun, 12 Mar 2017 00:17:04 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: dev@curator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CURATOR-391) PathChildrenCache missing events upon reconnection MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Sun, 12 Mar 2017 00:17:11 -0000 [ https://issues.apache.org/jira/browse/CURATOR-391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15906366#comment-15906366 ] ASF GitHub Bot commented on CURATOR-391: ---------------------------------------- Github user Randgalt commented on a diff in the pull request: https://github.com/apache/curator/pull/202#discussion_r105545481 --- Diff: curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/PathChildrenCache.java --- @@ -694,14 +695,23 @@ private void applyNewData(String fullPath, int resultCode, Stat stat, byte[] byt { offerOperation(new EventOperation(this, new PathChildrenCacheEvent(PathChildrenCacheEvent.Type.CHILD_ADDED, data))); } - else if ( previousData.getStat().getVersion() != stat.getVersion() ) + else if ( hasChanged(stat, previousData, data) ) { offerOperation(new EventOperation(this, new PathChildrenCacheEvent(PathChildrenCacheEvent.Type.CHILD_UPDATED, data))); } updateInitialSet(ZKPaths.getNodeFromPath(fullPath), data); } } + private boolean hasChanged(Stat stat, ChildData previousData, ChildData newData) + { + if ( cacheData ) + { + return !Arrays.equals(previousData.getData(), newData.getData()); --- End diff -- It's not possible to do anything else. The only data we have is the version and the data itself. As a general rule, it's not possible to get every event in ZooKeeper. > PathChildrenCache missing events upon reconnection > -------------------------------------------------- > > Key: CURATOR-391 > URL: https://issues.apache.org/jira/browse/CURATOR-391 > Project: Apache Curator > Issue Type: Bug > Components: Recipes > Reporter: Benjamin Jaton > Assignee: Jordan Zimmerman > Fix For: 3.3.1, 2.12.1 > > > PathChildrenCache attempts to check for any change that occurred during a connection loss in applyNewData(): > {code:title=PathChildrenCache.java|borderStyle=solid} > else if ( previousData.getStat().getVersion() != stat.getVersion() ) > {code} > The way to compare stats is erroneous. {{version}} will be reset if the node is recreated. So the above code only works if an update has been made, but it may miss changes that involve a delete event. > Example: > - node /tmp is just created, version=0 > - connection loss > - node /tmp is deleted > - node /tmp is recreated with new data, version=0 > - reconnect > - no data change event from PathChildrenCache -- This message was sent by Atlassian JIRA (v6.3.15#6346)