zookeeper icon indicating copy to clipboard operation
zookeeper copied to clipboard

ZOOKEEPER-3611:addWatch api supports all watch event type, strengthen the corresponding CLI and add a documentation

Open maoling opened this issue 6 years ago • 5 comments

  • add three new modes: STANDARD_CHILD,STANDARD_DATA, STANDARD_EXIST to addWatch() api to keep behavior and semantics consistency with the original tradational one-time watch. For example: zk.getChildren(path, watch, stat); equals to zk.addWatch(path, watch, STANDARD_CHILD);
  • make the CLI: addWatch more user friendly and add a doc.
  • more details in the ZOOKEEPER-3611

maoling avatar Nov 18 '19 08:11 maoling

Thinking more about my comments on STANDARD_EXIST. I'm not sure what the right thing to do is. In the pre 3.6 ZK, setting an exists watcher is combined with an exists() request. So, the caller finds out about node existence and leaves a watcher either way. With addWatch() the caller won't know about node existence so that's why I suggested triggering immediately if the node exists. But, then, there's no way to set a watch via addWatch() that triggers if a node is deleted. I wonder if we also need STANDARD_DELETED? I'll think more but would appreciate other comments.


More: OK - I think STANDARD_EXIST should be removed from addWatch(). Essentially, the existing exists() method is the same thing as addWatch STANDARD_EXIST but it returns a Stat object so that the caller can know about node existence and the watch that gets set implies the correct thing. Or, alternatively, addWatch() can be changed to return a Stat object and STANDARD_EXIST would be an alias for exists(path, watcher).

Randgalt avatar Nov 18 '19 16:11 Randgalt

@Randgalt

  • This PR is missing some changes. DataTree's addWatch() method needs to be updated. Currently it adds the watcher to both dataWatches and childWatches.

Yes, it is. I have changed it. Think further, it don't affect the correctness of watch, the client cannot trigger twice, so I don't find this bug in the original patch.

  • Or, alternatively, addWatch() can be changed to return a Stat object and STANDARD_EXIST would be an alias for exists(path, watcher).

    I pick up this solution.

  • An obstacle I met is: when switch PERSISTENT watch to STANDARD watch in the same session. For example:

    [zk: localhost:2181(CONNECTED) 25] addWatch -p /test-watch
    [zk: localhost:2181(CONNECTED) 26] set /test-watch "foo"
    WATCHER::
    WatchedEvent state:SyncConnected type:NodeDataChanged path:/test-watch
    [zk: localhost:2181(CONNECTED) 27] addWatch -c /test-watch
    [zk: localhost:2181(CONNECTED) 28] set /test-watch "foo"
    WATCHER::
    WatchedEvent state:SyncConnected type:NodeDataChanged path:/test-watch
    [zk: localhost:2181(CONNECTED) 29] create /test-watch/ch-88
    WATCHER::
    WatchedEvent state:SyncConnected type:NodeChildrenChanged path:/test-watch
    Created /test-watch/ch-88
    

    when adding a child watch, it can also leave a data watch one that node. Switching STANDARD watch to PERSISTENT watch doesn't have that problem. Between that switch, we need a removeWatch to clean up the PERSISTENT watch. I also want to implement: a watch can override the previous PERSISTENT watch automatically on the server side, but it needs to change more codes.

  • The behavior of PERSISTENT watch is a little confused: it can also be triggered when its child has changed(first level). Overlap with PERSISTENT_RECURSIVE? It should only be fired when changes made by itself?

  • addWatch api needs to check the null watch. e.g zk.addWatch(BASE_PATH, null, STANDARD_CHILD);

maoling avatar Nov 20 '19 06:11 maoling

Refer to this link for build results (access rights to CI server needed): https://builds.apache.org/job/PreCommit-ZOOKEEPER-github-pr-build-maven/1743/

Build result: FAILURE

[...truncated 1001.66 KB...][JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/PreCommit-ZOOKEEPER-github-pr-build-maven/pom.xml to org.apache.zookeeper/parent/3.7.0-SNAPSHOT/parent-3.7.0-SNAPSHOT.pom[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/PreCommit-ZOOKEEPER-github-pr-build-maven/zookeeper-recipes/zookeeper-recipes-lock/pom.xml to org.apache.zookeeper/zookeeper-recipes-lock/3.7.0-SNAPSHOT/zookeeper-recipes-lock-3.7.0-SNAPSHOT.pom[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/PreCommit-ZOOKEEPER-github-pr-build-maven/zookeeper-contrib/pom.xml to org.apache.zookeeper/zookeeper-contrib/3.7.0-SNAPSHOT/zookeeper-contrib-3.7.0-SNAPSHOT.pom[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/PreCommit-ZOOKEEPER-github-pr-build-maven/zookeeper-client/pom.xml to org.apache.zookeeper/zookeeper-client/3.7.0-SNAPSHOT/zookeeper-client-3.7.0-SNAPSHOT.pom[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/PreCommit-ZOOKEEPER-github-pr-build-maven/zookeeper-jute/pom.xml to org.apache.zookeeper/zookeeper-jute/3.7.0-SNAPSHOT/zookeeper-jute-3.7.0-SNAPSHOT.pom[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/PreCommit-ZOOKEEPER-github-pr-build-maven/zookeeper-jute/target/zookeeper-jute-3.7.0-SNAPSHOT.jar to org.apache.zookeeper/zookeeper-jute/3.7.0-SNAPSHOT/zookeeper-jute-3.7.0-SNAPSHOT.jar[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/PreCommit-ZOOKEEPER-github-pr-build-maven/zookeeper-jute/target/zookeeper-jute-3.7.0-SNAPSHOT-tests.jar to org.apache.zookeeper/zookeeper-jute/3.7.0-SNAPSHOT/zookeeper-jute-3.7.0-SNAPSHOT-tests.jar[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/PreCommit-ZOOKEEPER-github-pr-build-maven/zookeeper-jute/target/zookeeper-jute-3.7.0-SNAPSHOT-sources.jar to org.apache.zookeeper/zookeeper-jute/3.7.0-SNAPSHOT/zookeeper-jute-3.7.0-SNAPSHOT-sources.jar[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/PreCommit-ZOOKEEPER-github-pr-build-maven/zookeeper-jute/target/zookeeper-jute-3.7.0-SNAPSHOT-javadoc.jar to org.apache.zookeeper/zookeeper-jute/3.7.0-SNAPSHOT/zookeeper-jute-3.7.0-SNAPSHOT-javadoc.jar[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/PreCommit-ZOOKEEPER-github-pr-build-maven/zookeeper-recipes/zookeeper-recipes-queue/pom.xml to org.apache.zookeeper/zookeeper-recipes-queue/3.7.0-SNAPSHOT/zookeeper-recipes-queue-3.7.0-SNAPSHOT.pom[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/PreCommit-ZOOKEEPER-github-pr-build-maven/zookeeper-docs/pom.xml to org.apache.zookeeper/zookeeper-docs/3.7.0-SNAPSHOT/zookeeper-docs-3.7.0-SNAPSHOT.pom[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/PreCommit-ZOOKEEPER-github-pr-build-maven/zookeeper-docs/target/zookeeper-docs-3.7.0-SNAPSHOT.jar to org.apache.zookeeper/zookeeper-docs/3.7.0-SNAPSHOT/zookeeper-docs-3.7.0-SNAPSHOT.jar[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/PreCommit-ZOOKEEPER-github-pr-build-maven/zookeeper-docs/target/zookeeper-docs-3.7.0-SNAPSHOT-tests.jar to org.apache.zookeeper/zookeeper-docs/3.7.0-SNAPSHOT/zookeeper-docs-3.7.0-SNAPSHOT-tests.jar[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/PreCommit-ZOOKEEPER-github-pr-build-maven/zookeeper-docs/target/zookeeper-docs-3.7.0-SNAPSHOT-sources.jar to org.apache.zookeeper/zookeeper-docs/3.7.0-SNAPSHOT/zookeeper-docs-3.7.0-SNAPSHOT-sources.jar[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/PreCommit-ZOOKEEPER-github-pr-build-maven/zookeeper-recipes/pom.xml to org.apache.zookeeper/zookeeper-recipes/3.7.0-SNAPSHOT/zookeeper-recipes-3.7.0-SNAPSHOT.pom[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/PreCommit-ZOOKEEPER-github-pr-build-maven/zookeeper-client/zookeeper-client-c/pom.xml to org.apache.zookeeper/zookeeper-client-c/3.7.0-SNAPSHOT/zookeeper-client-c-3.7.0-SNAPSHOT.pom[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/PreCommit-ZOOKEEPER-github-pr-build-maven/zookeeper-contrib/zookeeper-contrib-rest/pom.xml to org.apache.zookeeper/zookeeper-contrib-rest/3.7.0-SNAPSHOT/zookeeper-contrib-rest-3.7.0-SNAPSHOT.pom[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/PreCommit-ZOOKEEPER-github-pr-build-maven/zookeeper-assembly/pom.xml to org.apache.zookeeper/zookeeper-assembly/3.7.0-SNAPSHOT/zookeeper-assembly-3.7.0-SNAPSHOT.pom[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/PreCommit-ZOOKEEPER-github-pr-build-maven/zookeeper-contrib/zookeeper-contrib-zooinspector/pom.xml to org.apache.zookeeper/zookeeper-contrib-zooinspector/3.7.0-SNAPSHOT/zookeeper-contrib-zooinspector-3.7.0-SNAPSHOT.pomchannel stopped[SpotBugs] Skipping execution of recorder since overall result is 'FAILURE'Setting status of 3c05834a4ff2ca88c55c2ae9b63b7b1f4cd76d9f to FAILURE with url https://builds.apache.org/job/PreCommit-ZOOKEEPER-github-pr-build-maven/1743/ and message: 'FAILURE 'Using context: JenkinsMaven

asf-ci avatar Dec 17 '19 08:12 asf-ci

unsubscribe

---Original--- From: "ASF CI System"<[email protected]> Date: Tue, Dec 17, 2019 16:46 PM To: "apache/zookeeper"<[email protected]>; Cc: "Subscribed"<[email protected]>; Subject: Re: [apache/zookeeper] ZOOKEEPER-3611:addWatch api supports all watch event type, strengthen the corresponding CLI and add a documentation (#1149)

Refer to this link for build results (access rights to CI server needed): https://builds.apache.org/job/PreCommit-ZOOKEEPER-github-pr-build-maven/1743/

Build result: FAILURE [...truncated 1001.66 KB...][JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/PreCommit-ZOOKEEPER-github-pr-build-maven/pom.xml to org.apache.zookeeper/parent/3.7.0-SNAPSHOT/parent-3.7.0-SNAPSHOT.pom[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/PreCommit-ZOOKEEPER-github-pr-build-maven/zookeeper-recipes/zookeeper-recipes-lock/pom.xml to org.apache.zookeeper/zookeeper-recipes-lock/3.7.0-SNAPSHOT/zookeeper-recipes-lock-3.7.0-SNAPSHOT.pom[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/PreCommit-ZOOKEEPER-github-pr-build-maven/zookeeper-contrib/pom.xml to org.apache.zookeeper/zookeeper-contrib/3.7.0-SNAPSHOT/zookeeper-contrib-3.7.0-SNAPSHOT.pom[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/PreCommit-ZOOKEEPER-github-pr-build-maven/zookeeper-client/pom.xml to org.apache.zookeeper/zookeeper-client/3.7.0-SNAPSHOT/zookeeper-client-3.7.0-SNAPSHOT.pom[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/PreCommit-ZOOKEEPER-github-pr-build-maven/zookeeper-jute/pom.xml to org.apache.zookeeper/zookeeper-jute/3.7.0-SNAPSHOT/zookeeper-jute-3.7.0-SNAPSHOT.pom[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/PreCommit-ZOOKEEPER-github-pr-build-maven/zookeeper-jute/target/zookeeper-jute-3.7.0-SNAPSHOT.jar to org.apache.zookeeper/zookeeper-jute/3.7.0-SNAPSHOT/zookeeper-jute-3.7.0-SNAPSHOT.jar[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/PreCommit-ZOOKEEPER-github-pr-build-maven/zookeeper-jute/target/zookeeper-jute-3.7.0-SNAPSHOT-tests.jar to org.apache.zookeeper/zookeeper-jute/3.7.0-SNAPSHOT/zookeeper-jute-3.7.0-SNAPSHOT-tests.jar[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/PreCommit-ZOOKEEPER-github-pr-build-maven/zookeeper-jute/target/zookeeper-jute-3.7.0-SNAPSHOT-sources.jar to org.apache.zookeeper/zookeeper-jute/3.7.0-SNAPSHOT/zookeeper-jute-3.7.0-SNAPSHOT-sources.jar[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/PreCommit-ZOOKEEPER-github-pr-build-maven/zookeeper-jute/target/zookeeper-jute-3.7.0-SNAPSHOT-javadoc.jar to org.apache.zookeeper/zookeeper-jute/3.7.0-SNAPSHOT/zookeeper-jute-3.7.0-SNAPSHOT-javadoc.jar[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/PreCommit-ZOOKEEPER-github-pr-build-maven/zookeeper-recipes/zookeeper-recipes-queue/pom.xml to org.apache.zookeeper/zookeeper-recipes-queue/3.7.0-SNAPSHOT/zookeeper-recipes-queue-3.7.0-SNAPSHOT.pom[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/PreCommit-ZOOKEEPER-github-pr-build-maven/zookeeper-docs/pom.xml to org.apache.zookeeper/zookeeper-docs/3.7.0-SNAPSHOT/zookeeper-docs-3.7.0-SNAPSHOT.pom[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/PreCommit-ZOOKEEPER-github-pr-build-maven/zookeeper-docs/target/zookeeper-docs-3.7.0-SNAPSHOT.jar to org.apache.zookeeper/zookeeper-docs/3.7.0-SNAPSHOT/zookeeper-docs-3.7.0-SNAPSHOT.jar[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/PreCommit-ZOOKEEPER-github-pr-build-maven/zookeeper-docs/target/zookeeper-docs-3.7.0-SNAPSHOT-tests.jar to org.apache.zookeeper/zookeeper-docs/3.7.0-SNAPSHOT/zookeeper-docs-3.7.0-SNAPSHOT-tests.jar[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/PreCommit-ZOOKEEPER-github-pr-build-maven/zookeeper-docs/target/zookeeper-docs-3.7.0-SNAPSHOT-sources.jar to org.apache.zookeeper/zookeeper-docs/3.7.0-SNAPSHOT/zookeeper-docs-3.7.0-SNAPSHOT-sources.jar[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/PreCommit-ZOOKEEPER-github-pr-build-maven/zookeeper-recipes/pom.xml to org.apache.zookeeper/zookeeper-recipes/3.7.0-SNAPSHOT/zookeeper-recipes-3.7.0-SNAPSHOT.pom[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/PreCommit-ZOOKEEPER-github-pr-build-maven/zookeeper-client/zookeeper-client-c/pom.xml to org.apache.zookeeper/zookeeper-client-c/3.7.0-SNAPSHOT/zookeeper-client-c-3.7.0-SNAPSHOT.pom[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/PreCommit-ZOOKEEPER-github-pr-build-maven/zookeeper-contrib/zookeeper-contrib-rest/pom.xml to org.apache.zookeeper/zookeeper-contrib-rest/3.7.0-SNAPSHOT/zookeeper-contrib-rest-3.7.0-SNAPSHOT.pom[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/PreCommit-ZOOKEEPER-github-pr-build-maven/zookeeper-assembly/pom.xml to org.apache.zookeeper/zookeeper-assembly/3.7.0-SNAPSHOT/zookeeper-assembly-3.7.0-SNAPSHOT.pom[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/PreCommit-ZOOKEEPER-github-pr-build-maven/zookeeper-contrib/zookeeper-contrib-zooinspector/pom.xml to org.apache.zookeeper/zookeeper-contrib-zooinspector/3.7.0-SNAPSHOT/zookeeper-contrib-zooinspector-3.7.0-SNAPSHOT.pomchannel stopped[SpotBugs] Skipping execution of recorder since overall result is 'FAILURE'Setting status of 3c05834 to FAILURE with url https://builds.apache.org/job/PreCommit-ZOOKEEPER-github-pr-build-maven/1743/ and message: 'FAILURE 'Using context: JenkinsMaven

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

boromee avatar Dec 17 '19 09:12 boromee

Refer to this link for build results (access rights to CI server needed): https://builds.apache.org/job/PreCommit-ZOOKEEPER-github-pr-build-maven/1744/

Failed Tests: 1

PreCommit-ZOOKEEPER-github-pr-build-maven/org.apache.zookeeper:zookeeper: 1

asf-ci avatar Dec 17 '19 09:12 asf-ci