dlmarion commented on code in PR #4562:
URL: https://github.com/apache/accumulo/pull/4562#discussion_r1602262446


##########
server/manager/src/main/java/org/apache/accumulo/manager/Manager.java:
##########
@@ -740,6 +741,48 @@ private void cleanupOfflineMigrations() {
     }
   }
 
+  private class ScanServerZKCleaner implements Runnable {
+
+    @Override
+    public void run() {
+
+      final ZooReaderWriter zrw = getContext().getZooReaderWriter();
+      final String sserverZNodePath = getContext().getZooKeeperRoot() + 
Constants.ZSSERVERS;
+
+      while (stillManager()) {
+        try {
+          for (String sserverClientAddress : 
zrw.getChildren(sserverZNodePath)) {
+
+            final String sServerZPath = sserverZNodePath + "/" + 
sserverClientAddress;
+            final var zLockPath = ServiceLock.path(sServerZPath);
+            ZcStat stat = new ZcStat();
+            byte[] lockData = 
ServiceLock.getLockData(getContext().getZooCache(), zLockPath, stat);
+
+            if (lockData == null) {
+              try {
+                log.debug("Deleting empty ScanServer ZK node {}", 
sServerZPath);
+                zrw.delete(sServerZPath);
+              } catch (KeeperException.NotEmptyException e) {
+                log.debug(
+                    "Failed to delete ScanServer ZK node {} its not empty, 
likely an expected race condition.",
+                    sServerZPath);
+              }
+            }
+          }
+        } catch (KeeperException e) {
+          log.error("Exception trying to delete empty scan server ZNodes, will 
retry", e);
+        } catch (InterruptedException e) {
+          Thread.interrupted();
+          log.error("Interrupted trying to delete empty scan server ZNodes, 
will retry", e);
+        } finally {
+          // sleep for 5 mins
+          sleepUninterruptibly(TIME_BETWEEN_MIGRATION_CLEANUPS, MILLISECONDS);

Review Comment:
   Done in 91bfd6a



-- 
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]

Reply via email to