Review Board 1.7.22


ZOOKEEPER-442: need a way to remove watches that are no longer of interest

Review Request #3364 - Created Jan. 4, 2012 and updated

Daniel Gómez Ferro
trunk
ZOOKEEPER-442
Reviewers
zookeeper
breed
zookeeper-git
Added APIs to remove watches that are not needed anymore. If the removal completes successfully it is guaranteed that the watcher won't be notified.

With the current semantics if two clients remove watches on a znode at the same time the watch is triggered, one could remove it successfully while the other could receive the notification first.
Added unit test that checks client side semantics.
src/zookeeper.jute
Revision d24e145 New Change
[20] 69 lines
[+20]
70
    class SetWatches {
70
    class SetWatches {
71
        long relativeZxid;
71
        long relativeZxid;
72
        vector<ustring>dataWatches;
72
        vector<ustring>dataWatches;
73
        vector<ustring>existWatches;
73
        vector<ustring>existWatches;
74
        vector<ustring>childWatches;
74
        vector<ustring>childWatches;
75
    }        
75
    }
76
    class RequestHeader {
76
    class RequestHeader {
77
        int xid;
77
        int xid;
78
        int type;
78
        int type;
79
    }
79
    }
80
    class MultiHeader {
80
    class MultiHeader {
[+20] [20] 62 lines
[+20]
143
    }
143
    }
144
    class SetMaxChildrenRequest {
144
    class SetMaxChildrenRequest {
145
        ustring path;
145
        ustring path;
146
        int max;
146
        int max;
147
    }
147
    }

    
   
148
    class RemoveWatchesRequest {

    
   
149
        ustring path;

    
   
150
        int type;

    
   
151
    }
148
    class SyncRequest {
152
    class SyncRequest {
149
        ustring path;
153
        ustring path;
150
    }
154
    }
151
    class SyncResponse {
155
    class SyncResponse {
152
        ustring path;
156
        ustring path;
[+20] [20] 124 lines
src/java/main/org/apache/zookeeper/ClientCnxn.java
Revision 6c25e40 New Change
 
src/java/main/org/apache/zookeeper/KeeperException.java
Revision 7c10d2c New Change
 
src/java/main/org/apache/zookeeper/Watcher.java
Revision 36c7b5b New Change
 
src/java/main/org/apache/zookeeper/ZooDefs.java
Revision c7f1b20 New Change
 
src/java/main/org/apache/zookeeper/ZooKeeper.java
Revision e82eaa0 New Change
 
src/java/main/org/apache/zookeeper/server/DataTree.java
Revision 757a572 New Change
 
src/java/main/org/apache/zookeeper/server/FinalRequestProcessor.java
Revision 336827a New Change
 
src/java/main/org/apache/zookeeper/server/PrepRequestProcessor.java
Revision 1a80d74 New Change
 
src/java/main/org/apache/zookeeper/server/Request.java
Revision c6a2249 New Change
 
src/java/main/org/apache/zookeeper/server/WatchManager.java
Revision 0e7c815 New Change
 
src/java/main/org/apache/zookeeper/server/ZKDatabase.java
Revision 2842803 New Change
 
src/java/test/org/apache/zookeeper/test/RemoveWatchesTest.java
New File
 
  1. src/zookeeper.jute: Loading...
  2. src/java/main/org/apache/zookeeper/ClientCnxn.java: Loading...
  3. src/java/main/org/apache/zookeeper/KeeperException.java: Loading...
  4. src/java/main/org/apache/zookeeper/Watcher.java: Loading...
  5. src/java/main/org/apache/zookeeper/ZooDefs.java: Loading...
  6. src/java/main/org/apache/zookeeper/ZooKeeper.java: Loading...
  7. src/java/main/org/apache/zookeeper/server/DataTree.java: Loading...
  8. src/java/main/org/apache/zookeeper/server/FinalRequestProcessor.java: Loading...
  9. src/java/main/org/apache/zookeeper/server/PrepRequestProcessor.java: Loading...
  10. src/java/main/org/apache/zookeeper/server/Request.java: Loading...
  11. src/java/main/org/apache/zookeeper/server/WatchManager.java: Loading...
  12. src/java/main/org/apache/zookeeper/server/ZKDatabase.java: Loading...
  13. src/java/test/org/apache/zookeeper/test/RemoveWatchesTest.java: Loading...