ctubbsii commented on code in PR #5256:
URL: https://github.com/apache/accumulo/pull/5256#discussion_r1927403768


##########
core/src/main/java/org/apache/accumulo/core/zookeeper/ZooSession.java:
##########
@@ -188,6 +194,28 @@ private synchronized ZooKeeper reconnect() {
               digestAuth(zk, instanceSecret);
             }
             tryAgain = false;
+            if (!persistentWatcherPaths.isEmpty()) {
+              // We need to wait until the connection is alive, else we run 
into
+              // a case where addPersistentRecursiveWatchers calls 
verifyConnected
+              // which calls reconnect.
+              do {
+                UtilWaitThread.sleep(100);
+              } while (!zk.getState().isAlive());
+              for (Entry<String,Watcher> entry : 
persistentWatcherPaths.entrySet()) {
+                try {
+                  addPersistentRecursiveWatchers(Set.of(entry.getKey()), 
entry.getValue());
+                } catch (KeeperException e) {
+                  log.error("Error setting persistent recursive watcher at " + 
entry.getKey(), e);
+                  tryAgain = true;
+                  break;
+                } catch (InterruptedException e) {
+                  Thread.currentThread().interrupt();
+                  log.error("Interrupted setting persistent recursive watcher 
at " + entry.getKey(),
+                      e);
+                  tryAgain = true;
+                }
+              }

Review Comment:
   The watcher should eventually see the disconnected or expired events from 
zk1 in this 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.

To unsubscribe, e-mail: notifications-unsubscr...@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to