[3/4] curator git commit: Fix race condition in TreeCache.
Fix race condition in TreeCache. Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/b4da5f5c Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/b4da5f5c Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/b4da5f5c Branch: refs/heads/CURATOR-3.0 Commit: b4da5f5ca279905097b1fe7d5eb9710c6dc8bdd2 Parents: 4473c6b Author: Scott BlumAuthored: Wed May 25 21:49:29 2016 -0400 Committer: Scott Blum Committed: Wed May 25 23:21:43 2016 -0400 -- .../framework/recipes/cache/TreeCache.java | 20 +--- .../recipes/cache/TestEventOrdering.java| 4 +++- 2 files changed, 20 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/curator/blob/b4da5f5c/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 2dbe699..914d336 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 @@ -446,12 +446,26 @@ public class TreeCache implements Closeable oldChildData = childData.getAndSet(new ChildData(event.getPath(), newStat, null)); } -NodeState oldState = nodeState.getAndSet(NodeState.LIVE); -if ( oldState == NodeState.PENDING || (oldState == NodeState.DEAD && parent == null)) +boolean added; +if (parent == null) { +// We're the singleton root. +added = nodeState.getAndSet(NodeState.LIVE) != NodeState.LIVE; +} else { +added = nodeState.compareAndSet(NodeState.PENDING, NodeState.LIVE); +if (!added) { +// Ordinary nodes are not allowed to transition from dead -> live; +// make sure this isn't a delayed response that came in after death. +if (nodeState.get() != NodeState.LIVE) { +return; +} +} +} + +if ( added ) { publishEvent(TreeCacheEvent.Type.NODE_ADDED, toPublish); } -else if ( oldState == NodeState.LIVE ) +else { if ( oldChildData == null || oldChildData.getStat().getMzxid() != newStat.getMzxid() ) { http://git-wip-us.apache.org/repos/asf/curator/blob/b4da5f5c/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 5f294cf..216c07c 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 @@ -166,10 +166,12 @@ public abstract class TestEventOrdering extends BaseClassFo private String asString(List events) { +int qty = 0; StringBuilder str = new StringBuilder(); for ( Event event : events ) { -str.append(event.eventType).append(" ").append(event.path).append(" @ ").append(event.time - start); +qty += (event.eventType == EventType.ADDED) ? 1 : -1; +str.append(event.eventType).append(" ").append(event.path).append(" @ ").append(event.time - start).append(' ').append(qty); str.append("\n"); } return str.toString();
[4/4] curator git commit: Merge branch 'master' into CURATOR-3.0
Merge branch 'master' into CURATOR-3.0 Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/eefdf8ee Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/eefdf8ee Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/eefdf8ee Branch: refs/heads/CURATOR-3.0 Commit: eefdf8ee93ae9708ac52711e4981a2925bba2c40 Parents: c9b10d7 b4da5f5 Author: Scott BlumAuthored: Wed May 25 23:38:45 2016 -0400 Committer: Scott Blum Committed: Wed May 25 23:38:45 2016 -0400 -- .../framework/recipes/cache/TreeCache.java | 20 +--- .../recipes/cache/TestEventOrdering.java| 4 +++- 2 files changed, 20 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/curator/blob/eefdf8ee/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/TreeCache.java --
[2/4] curator git commit: [maven-release-plugin] prepare for next development iteration
[maven-release-plugin] prepare for next development iteration Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/4473c6b6 Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/4473c6b6 Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/4473c6b6 Branch: refs/heads/CURATOR-3.0 Commit: 4473c6b6c9dad81ca5db0021ea97c12a559b159c Parents: a5a2423 Author: Cam McKenzieAuthored: Wed May 25 09:14:07 2016 +1000 Committer: Cam McKenzie Committed: Wed May 25 09:14:07 2016 +1000 -- curator-client/pom.xml | 4 ++-- curator-examples/pom.xml | 2 +- curator-framework/pom.xml | 4 ++-- curator-recipes/pom.xml| 4 ++-- curator-test/pom.xml | 4 ++-- curator-x-discovery-server/pom.xml | 4 ++-- curator-x-discovery/pom.xml| 4 ++-- curator-x-rpc/pom.xml | 4 ++-- pom.xml| 4 ++-- 9 files changed, 17 insertions(+), 17 deletions(-) -- http://git-wip-us.apache.org/repos/asf/curator/blob/4473c6b6/curator-client/pom.xml -- diff --git a/curator-client/pom.xml b/curator-client/pom.xml index e6e5a4e..7413fe5 100644 --- a/curator-client/pom.xml +++ b/curator-client/pom.xml @@ -24,11 +24,11 @@ org.apache.curator apache-curator -2.11.0 +2.11.0-SNAPSHOT curator-client -2.11.0 +2.11.0-SNAPSHOT bundle Curator Client http://git-wip-us.apache.org/repos/asf/curator/blob/4473c6b6/curator-examples/pom.xml -- diff --git a/curator-examples/pom.xml b/curator-examples/pom.xml index c783342..a3af1a2 100644 --- a/curator-examples/pom.xml +++ b/curator-examples/pom.xml @@ -24,7 +24,7 @@ org.apache.curator apache-curator -2.11.0 +2.11.0-SNAPSHOT curator-examples http://git-wip-us.apache.org/repos/asf/curator/blob/4473c6b6/curator-framework/pom.xml -- diff --git a/curator-framework/pom.xml b/curator-framework/pom.xml index 130ee4e..0c8e44c 100644 --- a/curator-framework/pom.xml +++ b/curator-framework/pom.xml @@ -24,11 +24,11 @@ org.apache.curator apache-curator -2.11.0 +2.11.0-SNAPSHOT curator-framework -2.11.0 +2.11.0-SNAPSHOT bundle Curator Framework http://git-wip-us.apache.org/repos/asf/curator/blob/4473c6b6/curator-recipes/pom.xml -- diff --git a/curator-recipes/pom.xml b/curator-recipes/pom.xml index 55f2023..8dc3c16 100644 --- a/curator-recipes/pom.xml +++ b/curator-recipes/pom.xml @@ -24,11 +24,11 @@ org.apache.curator apache-curator -2.11.0 +2.11.0-SNAPSHOT curator-recipes -2.11.0 +2.11.0-SNAPSHOT bundle Curator Recipes http://git-wip-us.apache.org/repos/asf/curator/blob/4473c6b6/curator-test/pom.xml -- diff --git a/curator-test/pom.xml b/curator-test/pom.xml index d41c2a8..ad1d0ad 100644 --- a/curator-test/pom.xml +++ b/curator-test/pom.xml @@ -24,11 +24,11 @@ org.apache.curator apache-curator -2.11.0 +2.11.0-SNAPSHOT curator-test -2.11.0 +2.11.0-SNAPSHOT Curator Testing Unit testing utilities. http://git-wip-us.apache.org/repos/asf/curator/blob/4473c6b6/curator-x-discovery-server/pom.xml -- diff --git a/curator-x-discovery-server/pom.xml b/curator-x-discovery-server/pom.xml index d8a6147..baef278 100644 --- a/curator-x-discovery-server/pom.xml +++ b/curator-x-discovery-server/pom.xml @@ -24,11 +24,11 @@ org.apache.curator apache-curator -2.11.0 +2.11.0-SNAPSHOT curator-x-discovery-server -2.11.0 +2.11.0-SNAPSHOT bundle Curator Service Discovery Server http://git-wip-us.apache.org/repos/asf/curator/blob/4473c6b6/curator-x-discovery/pom.xml -- diff --git a/curator-x-discovery/pom.xml b/curator-x-discovery/pom.xml index c3039cb..003f59f 100644 --- a/curator-x-discovery/pom.xml +++ b/curator-x-discovery/pom.xml @@ -24,11 +24,11 @@ org.apache.curator apache-curator -2.11.0 +2.11.0-SNAPSHOT curator-x-discovery -2.11.0 +2.11.0-SNAPSHOT bundle Curator Service Discovery
[1/4] curator git commit: [maven-release-plugin] prepare release apache-curator-2.11.0-SNAPSHOT
Repository: curator Updated Branches: refs/heads/CURATOR-3.0 c9b10d745 -> eefdf8ee9 [maven-release-plugin] prepare release apache-curator-2.11.0-SNAPSHOT Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/a5a24230 Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/a5a24230 Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/a5a24230 Branch: refs/heads/CURATOR-3.0 Commit: a5a242303f386ee6556c2fb880d70dc500805499 Parents: 8f281eb Author: Cam McKenzieAuthored: Wed May 25 09:13:57 2016 +1000 Committer: Cam McKenzie Committed: Wed May 25 09:13:57 2016 +1000 -- curator-client/pom.xml | 4 ++-- curator-examples/pom.xml | 2 +- curator-framework/pom.xml | 4 ++-- curator-recipes/pom.xml| 4 ++-- curator-test/pom.xml | 4 ++-- curator-x-discovery-server/pom.xml | 4 ++-- curator-x-discovery/pom.xml| 4 ++-- curator-x-rpc/pom.xml | 4 ++-- pom.xml| 4 ++-- 9 files changed, 17 insertions(+), 17 deletions(-) -- http://git-wip-us.apache.org/repos/asf/curator/blob/a5a24230/curator-client/pom.xml -- diff --git a/curator-client/pom.xml b/curator-client/pom.xml index 4080eb5..e6e5a4e 100644 --- a/curator-client/pom.xml +++ b/curator-client/pom.xml @@ -24,11 +24,11 @@ org.apache.curator apache-curator -2.10.1-SNAPSHOT +2.11.0 curator-client -2.10.1-SNAPSHOT +2.11.0 bundle Curator Client http://git-wip-us.apache.org/repos/asf/curator/blob/a5a24230/curator-examples/pom.xml -- diff --git a/curator-examples/pom.xml b/curator-examples/pom.xml index 21be8fd..c783342 100644 --- a/curator-examples/pom.xml +++ b/curator-examples/pom.xml @@ -24,7 +24,7 @@ org.apache.curator apache-curator -2.10.1-SNAPSHOT +2.11.0 curator-examples http://git-wip-us.apache.org/repos/asf/curator/blob/a5a24230/curator-framework/pom.xml -- diff --git a/curator-framework/pom.xml b/curator-framework/pom.xml index 660fc15..130ee4e 100644 --- a/curator-framework/pom.xml +++ b/curator-framework/pom.xml @@ -24,11 +24,11 @@ org.apache.curator apache-curator -2.10.1-SNAPSHOT +2.11.0 curator-framework -2.10.1-SNAPSHOT +2.11.0 bundle Curator Framework http://git-wip-us.apache.org/repos/asf/curator/blob/a5a24230/curator-recipes/pom.xml -- diff --git a/curator-recipes/pom.xml b/curator-recipes/pom.xml index 6f4c81a..55f2023 100644 --- a/curator-recipes/pom.xml +++ b/curator-recipes/pom.xml @@ -24,11 +24,11 @@ org.apache.curator apache-curator -2.10.1-SNAPSHOT +2.11.0 curator-recipes -2.10.1-SNAPSHOT +2.11.0 bundle Curator Recipes http://git-wip-us.apache.org/repos/asf/curator/blob/a5a24230/curator-test/pom.xml -- diff --git a/curator-test/pom.xml b/curator-test/pom.xml index f63fb0a..d41c2a8 100644 --- a/curator-test/pom.xml +++ b/curator-test/pom.xml @@ -24,11 +24,11 @@ org.apache.curator apache-curator -2.10.1-SNAPSHOT +2.11.0 curator-test -2.10.1-SNAPSHOT +2.11.0 Curator Testing Unit testing utilities. http://git-wip-us.apache.org/repos/asf/curator/blob/a5a24230/curator-x-discovery-server/pom.xml -- diff --git a/curator-x-discovery-server/pom.xml b/curator-x-discovery-server/pom.xml index b60b0a0..d8a6147 100644 --- a/curator-x-discovery-server/pom.xml +++ b/curator-x-discovery-server/pom.xml @@ -24,11 +24,11 @@ org.apache.curator apache-curator -2.10.1-SNAPSHOT +2.11.0 curator-x-discovery-server -2.10.1-SNAPSHOT +2.11.0 bundle Curator Service Discovery Server http://git-wip-us.apache.org/repos/asf/curator/blob/a5a24230/curator-x-discovery/pom.xml -- diff --git a/curator-x-discovery/pom.xml b/curator-x-discovery/pom.xml index 7a0890f..c3039cb 100644 --- a/curator-x-discovery/pom.xml +++ b/curator-x-discovery/pom.xml @@ -24,11 +24,11 @@ org.apache.curator apache-curator -2.10.1-SNAPSHOT +2.11.0 curator-x-discovery -2.10.1-SNAPSHOT +2.11.0
curator git commit: Fix race condition in TreeCache.
Repository: curator Updated Branches: refs/heads/master 4473c6b6c -> b4da5f5ca Fix race condition in TreeCache. Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/b4da5f5c Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/b4da5f5c Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/b4da5f5c Branch: refs/heads/master Commit: b4da5f5ca279905097b1fe7d5eb9710c6dc8bdd2 Parents: 4473c6b Author: Scott BlumAuthored: Wed May 25 21:49:29 2016 -0400 Committer: Scott Blum Committed: Wed May 25 23:21:43 2016 -0400 -- .../framework/recipes/cache/TreeCache.java | 20 +--- .../recipes/cache/TestEventOrdering.java| 4 +++- 2 files changed, 20 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/curator/blob/b4da5f5c/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 2dbe699..914d336 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 @@ -446,12 +446,26 @@ public class TreeCache implements Closeable oldChildData = childData.getAndSet(new ChildData(event.getPath(), newStat, null)); } -NodeState oldState = nodeState.getAndSet(NodeState.LIVE); -if ( oldState == NodeState.PENDING || (oldState == NodeState.DEAD && parent == null)) +boolean added; +if (parent == null) { +// We're the singleton root. +added = nodeState.getAndSet(NodeState.LIVE) != NodeState.LIVE; +} else { +added = nodeState.compareAndSet(NodeState.PENDING, NodeState.LIVE); +if (!added) { +// Ordinary nodes are not allowed to transition from dead -> live; +// make sure this isn't a delayed response that came in after death. +if (nodeState.get() != NodeState.LIVE) { +return; +} +} +} + +if ( added ) { publishEvent(TreeCacheEvent.Type.NODE_ADDED, toPublish); } -else if ( oldState == NodeState.LIVE ) +else { if ( oldChildData == null || oldChildData.getStat().getMzxid() != newStat.getMzxid() ) { http://git-wip-us.apache.org/repos/asf/curator/blob/b4da5f5c/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 5f294cf..216c07c 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 @@ -166,10 +166,12 @@ public abstract class TestEventOrdering extends BaseClassFo private String asString(List events) { +int qty = 0; StringBuilder str = new StringBuilder(); for ( Event event : events ) { -str.append(event.eventType).append(" ").append(event.path).append(" @ ").append(event.time - start); +qty += (event.eventType == EventType.ADDED) ? 1 : -1; +str.append(event.eventType).append(" ").append(event.path).append(" @ ").append(event.time - start).append(' ').append(qty); str.append("\n"); } return str.toString();