You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zookeeper.apache.org by rg...@apache.org on 2016/10/09 20:42:41 UTC
zookeeper git commit: ZOOKEEPER-2611: zoo_remove_watchers - can
remove the wrong watch (Eyal Leshmem via rgs)
Repository: zookeeper
Updated Branches:
refs/heads/master df5519ab9 -> f78061aaf
ZOOKEEPER-2611: zoo_remove_watchers - can remove the wrong watch
(Eyal Leshmem via rgs)
Project: http://git-wip-us.apache.org/repos/asf/zookeeper/repo
Commit: http://git-wip-us.apache.org/repos/asf/zookeeper/commit/f78061aa
Tree: http://git-wip-us.apache.org/repos/asf/zookeeper/tree/f78061aa
Diff: http://git-wip-us.apache.org/repos/asf/zookeeper/diff/f78061aa
Branch: refs/heads/master
Commit: f78061aafb19b102c37cb6d744ec6258d5f5b66e
Parents: df5519a
Author: Raul Gutierrez Segales <rg...@apache.org>
Authored: Sun Oct 9 13:40:36 2016 -0700
Committer: Raul Gutierrez Segales <rg...@apache.org>
Committed: Sun Oct 9 13:40:36 2016 -0700
----------------------------------------------------------------------
CHANGES.txt | 3 +++
src/c/src/zk_hashtable.c | 2 +-
src/c/tests/TestClient.cc | 24 ++++++++++++++++++++++--
3 files changed, 26 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/f78061aa/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 4a701c5..01f8d59 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -394,6 +394,9 @@ BUGFIXES:
ZOOKEEPER-2579: ZooKeeper server should verify that dataDir and
snapDir are writeable before starting (Abraham Fine via phunt)
+ ZOOKEEPER-2611: zoo_remove_watchers - can remove the wrong watch
+ (Eyal Leshmem via rgs)
+
IMPROVEMENTS:
ZOOKEEPER-2024 Major throughput improvement with mixed workloads (Kfir Lev-Ari via shralex)
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/f78061aa/src/c/src/zk_hashtable.c
----------------------------------------------------------------------
diff --git a/src/c/src/zk_hashtable.c b/src/c/src/zk_hashtable.c
index 8f87a96..da3fb83 100644
--- a/src/c/src/zk_hashtable.c
+++ b/src/c/src/zk_hashtable.c
@@ -371,7 +371,7 @@ static void removeWatcherFromList(watcher_object_list_t *wl, watcher_fn watcher,
while (e){
if (e->next &&
e->next->watcher == watcher &&
- e->context == watcherCtx) {
+ e->next->context == watcherCtx) {
watcher_object_t *this = e->next;
e->next = e->next->next;
free(this);
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/f78061aa/src/c/tests/TestClient.cc
----------------------------------------------------------------------
diff --git a/src/c/tests/TestClient.cc b/src/c/tests/TestClient.cc
index 3fbcb1b..ab6a133 100644
--- a/src/c/tests/TestClient.cc
+++ b/src/c/tests/TestClient.cc
@@ -1331,6 +1331,10 @@ public:
&ZOO_OPEN_ACL_UNSAFE, 0, 0, 0);
CPPUNIT_ASSERT_EQUAL((int)ZOK, rc);
+ rc = zoo_create(zk, "/something2", "", 0,
+ &ZOO_OPEN_ACL_UNSAFE, 0, 0, 0);
+ CPPUNIT_ASSERT_EQUAL((int)ZOK, rc);
+
char buf[1024];
int blen = sizeof(buf);
rc = zoo_get(zk, "/something", 1, buf, &blen, NULL);
@@ -1381,13 +1385,29 @@ public:
zk = createClient(&ctx);
/* add a watch, stop the server, and remove it locally */
- rc = zoo_wget(zk, "/something", watcher_remove_watchers, NULL,
+ void* ctx1=(void*)0x1;
+ void* ctx2=(void*)0x2;
+
+ rc = zoo_wget(zk, "/something", watcher_remove_watchers, ctx1,
buf, &blen, NULL);
CPPUNIT_ASSERT_EQUAL((int)ZOK, rc);
+
+ rc = zoo_wget(zk, "/something2", watcher_remove_watchers, ctx2,
+ buf, &blen, NULL);
+ CPPUNIT_ASSERT_EQUAL((int)ZOK, rc);
+
stopServer();
rc = zoo_remove_watchers(zk, "/something", ZWATCHERTYPE_DATA,
- watcher_remove_watchers, NULL, 1);
+ watcher_remove_watchers, ctx1, 1);
CPPUNIT_ASSERT_EQUAL((int)ZOK, rc);
+
+ rc = zoo_remove_watchers(zk, "/something", ZWATCHERTYPE_DATA,
+ watcher_remove_watchers, ctx1, 1);
+ CPPUNIT_ASSERT_EQUAL((int)ZNOWATCHER, rc);
+
+ rc = zoo_remove_watchers(zk, "/something2", ZWATCHERTYPE_DATA,
+ watcher_remove_watchers, ctx2, 1);
+ CPPUNIT_ASSERT_EQUAL((int)ZOK,rc);
}
};