kaisun2000 commented on a change in pull request #1035:
URL: https://github.com/apache/helix/pull/1035#discussion_r432269670
##########
File path:
zookeeper-api/src/main/java/org/apache/helix/zookeeper/zkclient/ZkClient.java
##########
@@ -1865,17 +1934,24 @@ public Object call() throws Exception {
* exist.
*/
public List<String> watchForChilds(final String path) {
+ return watchForChilds(path, false);
+ }
+
+ private List<String> watchForChilds(final String path, boolean
skipWatchingNodeNotExist) {
if (_zookeeperEventThread != null && Thread.currentThread() ==
_zookeeperEventThread) {
throw new IllegalArgumentException("Must not be done in the zookeeper
event thread.");
}
return retryUntilConnected(new Callable<List<String>>() {
@Override
public List<String> call() throws Exception {
- exists(path, true);
+ if (!skipWatchingNodeNotExist) {
Review comment:
If skipWatchingNodeNotExist, we don't add watch to parent path. That is
exactly what we want.
We can think it this way.
1/ skipWatchingNodeNotExist true, if the parent path is not there. We will
not install watch.
2/ skipWatchingNodeNotExist false, namely original behavior, if the parent
path is not there, we will install exist data watch.
We discussed this in the meeting.
The second case is actually needed for current state callbackhandler
registration. LiveInstance change would cause current state callbackhandler to
be added to ZkHelixManager. And at the time, it can often be the case the
parent node of current state is not yet created. Note, this is the INIT case.
Later CALLBACK case, we should expect the current state parent path be
there. Otherwise, we should not register the watch to Zk server (or we will
leak a path). That is why we need the first case.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]