curator-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From randg...@apache.org
Subject [2/4] curator git commit: Fix TreeCache duplicate ADD events in rare cases.
Date Fri, 20 May 2016 02:38:24 GMT
Fix TreeCache duplicate ADD events in rare cases.


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/56525235
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/56525235
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/56525235

Branch: refs/heads/CURATOR-3.0
Commit: 56525235cc63b9c74b6286a44ef89f3ffca94a1a
Parents: ee34e2b
Author: Scott Blum <dragonsinth@apache.org>
Authored: Thu May 19 20:18:01 2016 -0400
Committer: Scott Blum <dragonsinth@apache.org>
Committed: Thu May 19 20:18:01 2016 -0400

----------------------------------------------------------------------
 .../org/apache/curator/framework/recipes/cache/TreeCache.java    | 4 ++--
 .../curator/framework/recipes/cache/TestEventOrdering.java       | 1 -
 2 files changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/56525235/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/TreeCache.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/TreeCache.java
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/TreeCache.java
index f762324..2dbe699 100644
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/TreeCache.java
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/TreeCache.java
@@ -447,11 +447,11 @@ public class TreeCache implements Closeable
                     }
 
                     NodeState oldState = nodeState.getAndSet(NodeState.LIVE);
-                    if ( oldState != NodeState.LIVE )
+                    if ( oldState == NodeState.PENDING || (oldState == NodeState.DEAD &&
parent == null))
                     {
                         publishEvent(TreeCacheEvent.Type.NODE_ADDED, toPublish);
                     }
-                    else
+                    else if ( oldState == NodeState.LIVE )
                     {
                         if ( oldChildData == null || oldChildData.getStat().getMzxid() !=
newStat.getMzxid() )
                         {

http://git-wip-us.apache.org/repos/asf/curator/blob/56525235/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestEventOrdering.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestEventOrdering.java
b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestEventOrdering.java
index 28a1655..8f332af 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestEventOrdering.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestEventOrdering.java
@@ -12,7 +12,6 @@ import org.apache.zookeeper.KeeperException;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 import java.io.Closeable;
-import java.util.Date;
 import java.util.List;
 import java.util.Random;
 import java.util.concurrent.BlockingQueue;


Mime
View raw message