keith-turner commented on code in PR #5256:
URL: https://github.com/apache/accumulo/pull/5256#discussion_r1924251882
##########
core/src/main/java/org/apache/accumulo/core/fate/zookeeper/ZooCache.java:
##########
@@ -607,4 +616,32 @@ public Optional<ServiceLockData>
getLockData(ServiceLockPath path) {
return ServiceLockData.parse(lockData);
}
+ @SuppressWarnings("deprecation")
+ @Override
+ public void process(WatchedEvent event) {
+ // ZooCache implements the Watcher interface so that it can
+ // receive events from the ZooSesssion session watcher.
+ switch (event.getState()) {
+ case SyncConnected:
+ log.info("{} ZooKeeper connection established, re-establishing
watchers; {}", cacheId,
+ event);
+ clear();
+ setupWatchers(pathsToWatch);
+ break;
+ case Closed:
+ case Disconnected:
+ this.watchersSet.set(false);
Review Comment:
When zoocache has registered a watcher w/ multiple zookeepers then the
events from different zookeepers could arrive in any order. Like the
Disconnected event from an old zookeeper could arrive after the SyncConnected
event from a newer zookeeper. Setting this false seems here seems to assume
the events will arrive in an expected order. This is the type of stuff that
makes the case for having a zoocache only deal w/ a single zookeeper obj, then
when an event arrives we can reason about it much more easily.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]