-
Notifications
You must be signed in to change notification settings - Fork 7.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ZOOKEEPER-4466: Support different watch modes on same path #1859
ZOOKEEPER-4466: Support different watch modes on same path #1859
Conversation
zookeeper-server/src/main/java/org/apache/zookeeper/server/watch/WatchManager.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great work
@lvfangmin @Randgalt @breed please take a look carefully.
I am afraid that we could inadvertently change the semantics of watchers
zookeeper-server/src/main/java/org/apache/zookeeper/server/watch/WatchManager.java
Outdated
Show resolved
Hide resolved
zookeeper-server/src/main/java/org/apache/zookeeper/server/watch/WatchStats.java
Outdated
Show resolved
Hide resolved
zookeeper-server/src/main/java/org/apache/zookeeper/server/watch/WatchStats.java
Outdated
Show resolved
Hide resolved
We need more eyes on this patch |
1722faa
to
c8557af
Compare
c8557af
to
4bdd355
Compare
Currently, in server side, there is only one watcher mode per path. This will destroy and corrupt old watch when client watch a watching path.
4bdd355
to
b65852e
Compare
Could you please take a look at this ? @tisonkun @eolivelli @Randgalt @symat @maoling @arshadmohammad @anmolnar @ztzg @lvfangmin @breed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
Unfortunately we need more eyes on this patch.
zookeeper-server/src/main/java/org/apache/zookeeper/server/DataTree.java
Show resolved
Hide resolved
Signed-off-by: tison <wander4096@gmail.com>
} | ||
} | ||
return false; | ||
Set<Watcher> list = watchTable.get(path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kezhuw Can you explain a bit why this change is correct?
It seems that previously, containsWatcher (path, watcher)
will be true
if any parent of the path has a persistent recursive watch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that previously, containsWatcher (path, watcher) will be true if any parent of the path has a persistent recursive watch.
It is no true though it might intend to do so. Two cases for old code:
- If there is a watch for (watcher, path), the first
return true
will hold. - If there is no watch for (watcher, path),
watcherMode
will beWatcherMode.STANDARD
, noreturn true
will hold:- First
return true
will not hold as it only apply for leaf node where there is no such watch. - Second
return true
will not hold asWatcherMode.STANDARD
is no recursive.
- First
So my change has same behavior as old code and also same to when it was introduced. I think this behavior meets what OpCode.checkWatches
expects which is the sole client visible call to this method. Disregard cheating behaviour of ZooKeeper.removeWatches
, removing sub nodes from recursive watching sounds quirk as similar one I saw in ZOOKEEPER-4471.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your explanation! I get it now :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rest looks good to me. One comment above.
Signed-off-by: tison <wander4096@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
} | ||
} | ||
return false; | ||
Set<Watcher> list = watchTable.get(path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your explanation! I get it now :)
Cc @Randgalt @lvfangmin @breed if you can take a look also. |
…st-with-same-path
Shall we merge this ? Or we need more eyeballs on this? @eolivelli @tisonkun @Randgalt @lvfangmin @breed @cnauroth @symat @maoling I guess lazy consensus could apply here if no more comments. |
Merging... Thanks for your contribution @kezhuw! |
PR apache#1950(ZOOKEEPER-4655) was created before apache#1859(ZOOKEEPER-4466) merged. It changes `assertEvent`'s signature which is depended by apache#1859.
…2012) PR #1950(ZOOKEEPER-4655) was created before #1859(ZOOKEEPER-4466) merged. It changes `assertEvent`'s signature which is depended by #1859.
PR #1950(ZOOKEEPER-4655) was created before #1859(ZOOKEEPER-4466) merged. It changes `assertEvent`'s signature which is depended by #1859.
Signed-off-by: Kezhu Wang <kezhuw@gmail.com> Co-authored-by: tison <wander4096@gmail.com>
…) (#49) Signed-off-by: Kezhu Wang <kezhuw@gmail.com> Co-authored-by: Kezhu Wang <kezhuw@gmail.com> Co-authored-by: tison <wander4096@gmail.com>
PR apache#1950(ZOOKEEPER-4655) was created before apache#1859(ZOOKEEPER-4466) merged. It changes `assertEvent`'s signature which is depended by apache#1859.
PR apache#1950(ZOOKEEPER-4655) was created before apache#1859(ZOOKEEPER-4466) merged. It changes `assertEvent`'s signature which is depended by apache#1859. Co-authored-by: Kezhu Wang <kezhuw@gmail.com>
PR apache#1950(ZOOKEEPER-4655) was created before apache#1859(ZOOKEEPER-4466) merged. It changes `assertEvent`'s signature which is depended by apache#1859.
Currently, in server side, there is only one watcher mode per path. This
will destroy and corrupt old watch when client watch a watching path.