Browse Source

ZOOKEEPER-622. Test for pending watches in send_set_watches should be moved (ben and steven via mahadev)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/zookeeper/trunk@919706 13f79535-47bb-0310-9956-ffa450edef68
Mahadev Konar 15 năm trước cách đây
mục cha
commit
a4e9208398
2 tập tin đã thay đổi với 12 bổ sung4 xóa
  1. 3 0
      CHANGES.txt
  2. 9 4
      src/c/src/zookeeper.c

+ 3 - 0
CHANGES.txt

@@ -243,6 +243,9 @@ BUGFIXES:
   ZOOKEEPER-687. LENonterminatetest fails on some machines. (mahadev)
 
   ZOOKEEPER-681. Minor doc issue re unset maxClientCnxns (phunt via mahadev)
+
+  ZOOKEEPER-622. Test for pending watches in send_set_watches should be moved
+  (ben and steven via mahadev)
  
 IMPROVEMENTS:
   ZOOKEEPER-473. cleanup junit tests to eliminate false positives due to

+ 9 - 4
src/c/src/zookeeper.c

@@ -1189,17 +1189,22 @@ static int send_set_watches(zhandle_t *zh)
     struct SetWatches req;
     int rc;
 
+    req.relativeZxid = zh->last_zxid;
+    req.dataWatches.data = collect_keys(zh->active_node_watchers, &req.dataWatches.count);
+    req.existWatches.data = collect_keys(zh->active_exist_watchers, &req.existWatches.count);
+    req.childWatches.data = collect_keys(zh->active_child_watchers, &req.childWatches.count);
+
     // return if there are no pending watches
     if (!req.dataWatches.count && !req.existWatches.count &&
         !req.childWatches.count) {
+        free_key_list(req.dataWatches.data, req.dataWatches.count);
+        free_key_list(req.existWatches.data, req.existWatches.count);
+        free_key_list(req.childWatches.data, req.childWatches.count);
         return ZOK;
     }
 
+
     oa = create_buffer_oarchive();
-    req.relativeZxid = zh->last_zxid;
-    req.dataWatches.data = collect_keys(zh->active_node_watchers, &req.dataWatches.count);
-    req.existWatches.data = collect_keys(zh->active_exist_watchers, &req.existWatches.count);
-    req.childWatches.data = collect_keys(zh->active_child_watchers, &req.childWatches.count);
     rc = serialize_RequestHeader(oa, "header", &h);
     rc = rc < 0 ? rc : serialize_SetWatches(oa, "req", &req);
     /* add this buffer to the head of the send queue */