You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by "meatballspaghetti (via GitHub)" <gi...@apache.org> on 2025/02/21 18:47:14 UTC

[PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

meatballspaghetti opened a new pull request, #5350:
URL: https://github.com/apache/accumulo/pull/5350

   This PR initializes ZooKeeper to a new root that allows the full path to be omitted elsewhere in ZooKeeper code.
   
   The original specified path for ZooKeeper functions was typically `/accumulo/[instanceId]/[remainingPathToDesiredNode]`. In this PR, ZooKeeper is initialized with the root after `/accumulo/[instanceId]`, allowing ZooKeeper functions in the code to only need to specify the `/[remainingPathToDesiredNode]` portion, eliminating redundancy. In other words, instead of needing to specify an absolute path, we can now specify a relative path.
   
   Original Issue: #4809 


-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "kevinrr888 (via GitHub)" <gi...@apache.org>.
kevinrr888 commented on code in PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#discussion_r1972479867


##########
core/src/main/java/org/apache/accumulo/core/metadata/schema/TabletMetadata.java:
##########
@@ -534,12 +534,10 @@ static TabletMetadata create(String id, String prevEndRow, String endRow) {
   public static synchronized Set<TServerInstance> getLiveTServers(ClientContext context) {
     final Set<TServerInstance> liveServers = new HashSet<>();
 
-    final String path = context.getZooKeeperRoot() + Constants.ZTSERVERS;
-
-    for (String child : context.getZooCache().getChildren(path)) {
-      checkServer(context, path, child).ifPresent(liveServers::add);
+    for (String child : context.getZooCache().getChildren(Constants.ZTSERVERS)) {
+      checkServer(context, Constants.ZTSERVERS, child).ifPresent(liveServers::add);
     }
-    log.trace("Found {} live tservers at ZK path: {}", liveServers.size(), path);
+    log.trace("Found {} live tservers at ZK path: {}", liveServers.size(), Constants.ZTSERVERS);

Review Comment:
   Yeah that makes sense. @meatballspaghetti - you can disregard all my comments mentioning including full path in Exception messages and logs and revert any changes you might have already made for this



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "meatballspaghetti (via GitHub)" <gi...@apache.org>.
meatballspaghetti commented on code in PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#discussion_r1998886303


##########
server/base/src/main/java/org/apache/accumulo/server/conf/store/impl/ZooPropStore.java:
##########
@@ -85,33 +83,28 @@ public class ZooPropStore implements PropStore, PropChangeListener {
     } else {
       this.cache = new PropCacheCaffeineImpl.Builder(propLoader).forTests(ticker).build();
     }
-
     try {
-      var path = ZooUtil.getRoot(instanceId);
-      if (zrw.exists(path, propStoreWatcher)) {
-        log.debug("Have a ZooKeeper connection and found instance node: {}", instanceId);
+      if (zrw.exists("/", propStoreWatcher)) {
+        log.debug("Have a ZooKeeper connection and found instance node: {}");
         zkReadyMon.setReady();
       } else {
-        throw new IllegalStateException("Instance may not have been initialized, root node: " + path
-            + " does not exist in ZooKeeper");
+        throw new IllegalStateException(
+            "Instance may not have been initialized, provided root node path does not exist in ZooKeeper");
       }
     } catch (InterruptedException ex) {
       Thread.currentThread().interrupt();
-      throw new IllegalStateException(
-          "Interrupted trying to read root node " + instanceId + " from ZooKeeper", ex);
+      throw new IllegalStateException("Interrupted trying to read root node from ZooKeeper", ex);

Review Comment:
   Fixed to specify that what is being failed to be read is the instance root node at `/accumulo/<uuid>`.



##########
server/base/src/main/java/org/apache/accumulo/server/conf/store/impl/ZooPropStore.java:
##########
@@ -85,33 +83,28 @@ public class ZooPropStore implements PropStore, PropChangeListener {
     } else {
       this.cache = new PropCacheCaffeineImpl.Builder(propLoader).forTests(ticker).build();
     }
-
     try {
-      var path = ZooUtil.getRoot(instanceId);
-      if (zrw.exists(path, propStoreWatcher)) {
-        log.debug("Have a ZooKeeper connection and found instance node: {}", instanceId);
+      if (zrw.exists("/", propStoreWatcher)) {
+        log.debug("Have a ZooKeeper connection and found instance node: {}");
         zkReadyMon.setReady();
       } else {
-        throw new IllegalStateException("Instance may not have been initialized, root node: " + path
-            + " does not exist in ZooKeeper");
+        throw new IllegalStateException(
+            "Instance may not have been initialized, provided root node path does not exist in ZooKeeper");
       }
     } catch (InterruptedException ex) {
       Thread.currentThread().interrupt();
-      throw new IllegalStateException(
-          "Interrupted trying to read root node " + instanceId + " from ZooKeeper", ex);
+      throw new IllegalStateException("Interrupted trying to read root node from ZooKeeper", ex);
     } catch (KeeperException ex) {
-      throw new IllegalStateException("Failed to read root node " + instanceId + " from ZooKeeper",
-          ex);
+      throw new IllegalStateException("Failed to read root node from ZooKeeper", ex);

Review Comment:
   Fixed to specify that what is being failed to be read is the instance root node at `/accumulo/<uuid>`.



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "dlmarion (via GitHub)" <gi...@apache.org>.
dlmarion commented on code in PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#discussion_r1968105055


##########
server/base/src/main/java/org/apache/accumulo/server/conf/store/impl/PropStoreWatcher.java:
##########
@@ -100,15 +103,15 @@ public void process(final WatchedEvent event) {
       case NodeDataChanged:
         path = event.getPath();
         log.trace("handle change event for path: {}", path);
-        propStoreKey = PropStoreKey.fromPath(path);
+        propStoreKey = PropStoreKey.fromPath(path, instanceId);

Review Comment:
   Ok, the reason for asking is that I remember (but can't find it at the moment) something that I came across when implementing the persistent recursive watchers that have been merged into main that said the event path passed in the WatchedEvent was the full path. I assume that this means that it's the path to the node that changed, not where the persistent recursive watcher is set. However, we will want to test again in main that the chroot prefix is removed on the watched paths.



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "kevinrr888 (via GitHub)" <gi...@apache.org>.
kevinrr888 commented on code in PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#discussion_r1972479867


##########
core/src/main/java/org/apache/accumulo/core/metadata/schema/TabletMetadata.java:
##########
@@ -534,12 +534,10 @@ static TabletMetadata create(String id, String prevEndRow, String endRow) {
   public static synchronized Set<TServerInstance> getLiveTServers(ClientContext context) {
     final Set<TServerInstance> liveServers = new HashSet<>();
 
-    final String path = context.getZooKeeperRoot() + Constants.ZTSERVERS;
-
-    for (String child : context.getZooCache().getChildren(path)) {
-      checkServer(context, path, child).ifPresent(liveServers::add);
+    for (String child : context.getZooCache().getChildren(Constants.ZTSERVERS)) {
+      checkServer(context, Constants.ZTSERVERS, child).ifPresent(liveServers::add);
     }
-    log.trace("Found {} live tservers at ZK path: {}", liveServers.size(), path);
+    log.trace("Found {} live tservers at ZK path: {}", liveServers.size(), Constants.ZTSERVERS);

Review Comment:
   Yeah that makes sense. @meatballspaghetti - you can disregard all my comments mentioning including full path in Exception messages and logs.



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "meatballspaghetti (via GitHub)" <gi...@apache.org>.
meatballspaghetti commented on code in PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#discussion_r1974316051


##########
server/manager/src/main/java/org/apache/accumulo/manager/upgrade/PreUpgradeValidation.java:
##########
@@ -88,7 +88,8 @@ private void validateACLs(ServerContext context) {
                 + "for instructions on how to fix.");
       }
     } catch (KeeperException | InterruptedException e) {
-      throw new RuntimeException("Upgrade Failed! Error validating nodes under " + rootPath, e);
+      throw new RuntimeException("Upgrade Failed! Error validating nodes under " + Constants.ZROOT,
+          e);

Review Comment:
   For now I changed this to just say "...under current root node".



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "meatballspaghetti (via GitHub)" <gi...@apache.org>.
meatballspaghetti commented on code in PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#discussion_r1977637220


##########
server/base/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthorizor.java:
##########
@@ -41,16 +42,15 @@ public class ZKAuthorizor implements Authorizor {
   private static final Logger log = LoggerFactory.getLogger(ZKAuthorizor.class);
 
   private final String ZKUserAuths = "/Authorizations";
+  private final String zkUserPath = Constants.ZUSERS;

Review Comment:
   Fixed for both variables.



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "meatballspaghetti (via GitHub)" <gi...@apache.org>.
meatballspaghetti commented on code in PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#discussion_r1977638870


##########
server/base/src/main/java/org/apache/accumulo/server/security/handler/ZKPermHandler.java:
##########
@@ -54,21 +54,16 @@ public class ZKPermHandler implements PermissionHandler {
   private static final Logger log = LoggerFactory.getLogger(ZKPermHandler.class);
 
   private ZooReaderWriter zoo;
-  private String zkUserPath;
-  private String ZKTablePath;
-  private String ZKNamespacePath;
   private ZooCache zooCache;
   private final String ZKUserSysPerms = "/System";
   private final String ZKUserTablePerms = "/Tables";
   private final String ZKUserNamespacePerms = "/Namespaces";
+  private final String zkUserPath = Constants.ZUSERS;

Review Comment:
   Fixed.



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "ctubbsii (via GitHub)" <gi...@apache.org>.
ctubbsii commented on PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#issuecomment-2704818281

   All the tests are now passing, including all the ITs. I'm going to give this another look over, but I think it's very close to being ready to merge, if not already ready.


-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "dlmarion (via GitHub)" <gi...@apache.org>.
dlmarion commented on code in PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#discussion_r1993367793


##########
server/base/src/main/java/org/apache/accumulo/server/conf/util/ZooPropEditor.java:
##########
@@ -180,7 +179,8 @@ private void printProperties(final ServerContext context, final PropStoreKey<?>
       writer.printf(": Property scope: %s\n", scope);
       writer.printf(": ZooKeeper path: %s\n", propKey.getPath());
       writer.printf(": Name: %s\n", getDisplayName(propKey, context));
-      writer.printf(": Id: %s\n", propKey.getId());
+      writer.printf(": Id: %s\n", propKey instanceof IdBasedPropStoreKey
+          ? ((IdBasedPropStoreKey<?>) propKey).getId() : "N/A");

Review Comment:
   ok, thanks for the explanation



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "ctubbsii (via GitHub)" <gi...@apache.org>.
ctubbsii commented on PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#issuecomment-2723128546

   ExternalCompaction_2_IT keeps failing for me, but not every time. So, I don't think it's related to this PR. I think it's a flaky test that has a race condition or something.


-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "meatballspaghetti (via GitHub)" <gi...@apache.org>.
meatballspaghetti commented on code in PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#discussion_r1968080465


##########
server/base/src/main/java/org/apache/accumulo/server/conf/store/impl/PropStoreWatcher.java:
##########
@@ -100,15 +103,15 @@ public void process(final WatchedEvent event) {
       case NodeDataChanged:
         path = event.getPath();
         log.trace("handle change event for path: {}", path);
-        propStoreKey = PropStoreKey.fromPath(path);
+        propStoreKey = PropStoreKey.fromPath(path, instanceId);

Review Comment:
   It is just the relative path here. Confirmed it by printing it out during PropStoreEventTest.



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "meatballspaghetti (via GitHub)" <gi...@apache.org>.
meatballspaghetti commented on code in PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#discussion_r1974313194


##########
server/base/src/main/java/org/apache/accumulo/server/util/ServiceStatusCmd.java:
##########
@@ -59,19 +59,24 @@ public void execute(final ServerContext context, final boolean json, final boole
 
     ZooReader zooReader = context.getZooSession().asReader();
 
-    final String zooRoot = context.getZooKeeperRoot();
-    LOG.trace("zooRoot: {}", zooRoot);
+    LOG.trace("zooRoot: {}", "");

Review Comment:
   Fixed.



##########
server/base/src/test/java/org/apache/accumulo/server/security/delegation/ZooAuthenticationKeyWatcherTest.java:
##########
@@ -70,7 +69,7 @@ public static void setupKeyGenerator() throws Exception {
 
   private ZooSession zk;
   private InstanceId instanceId;
-  private String baseNode;
+  private final String baseNode = Constants.ZDELEGATION_TOKEN_KEYS;

Review Comment:
   Fixed, inlined it.



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "ctubbsii (via GitHub)" <gi...@apache.org>.
ctubbsii commented on code in PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#discussion_r1999683398


##########
server/base/src/main/java/org/apache/accumulo/server/constraints/MetadataConstraints.java:
##########
@@ -400,8 +400,7 @@ private void validateServerFamily(ArrayList<Short> violations, ColumnUpdate colu
         String lockId = new String(columnUpdate.getValue(), UTF_8);
 
         try {
-          lockHeld = ServiceLock.isLockHeld(context.getZooCache(),
-              new ZooUtil.LockID(context.getZooKeeperRoot(), lockId));
+          lockHeld = ServiceLock.isLockHeld(context.getZooCache(), new ZooUtil.LockID("", lockId));

Review Comment:
   Created #5410



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "kevinrr888 (via GitHub)" <gi...@apache.org>.
kevinrr888 commented on code in PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#discussion_r1968053486


##########
server/base/src/main/java/org/apache/accumulo/server/init/ZooKeeperInitializer.java:
##########
@@ -79,40 +79,29 @@ void initializeConfig(final InstanceId instanceId, final ZooReaderWriter zoo) {
       if (zoo.exists(sysPropPath)) {
         return;
       }
-      var created = zoo.putPrivatePersistentData(sysPropPath,
+      var created = zoo.putPrivatePersistentData(zkInstanceRoot + sysPropPath,
           VersionedPropCodec.getDefault().toBytes(vProps), ZooUtil.NodeExistsPolicy.FAIL);
       if (!created) {
         throw new IllegalStateException(
             "Failed to create default system props during initialization at: {}" + sysPropPath);
       }
+      // if (!zoo.exists("/yea")) {
+      // throw new IllegalStateException("heres the stuff under root/iid/config: "
+      // + Arrays.toString(zoo.getData(zkInstanceRoot + Constants.ZCONFIG)));
+      // }

Review Comment:
   some debugging that was accidentally left in



##########
core/src/main/java/org/apache/accumulo/core/metadata/schema/TabletMetadata.java:
##########
@@ -534,12 +534,10 @@ static TabletMetadata create(String id, String prevEndRow, String endRow) {
   public static synchronized Set<TServerInstance> getLiveTServers(ClientContext context) {
     final Set<TServerInstance> liveServers = new HashSet<>();
 
-    final String path = context.getZooKeeperRoot() + Constants.ZTSERVERS;
-
-    for (String child : context.getZooCache().getChildren(path)) {
-      checkServer(context, path, child).ifPresent(liveServers::add);
+    for (String child : context.getZooCache().getChildren(Constants.ZTSERVERS)) {
+      checkServer(context, Constants.ZTSERVERS, child).ifPresent(liveServers::add);
     }
-    log.trace("Found {} live tservers at ZK path: {}", liveServers.size(), path);
+    log.trace("Found {} live tservers at ZK path: {}", liveServers.size(), Constants.ZTSERVERS);

Review Comment:
   We would probably still want to log the full path



##########
server/base/src/main/java/org/apache/accumulo/server/init/ZooKeeperInitializer.java:
##########
@@ -205,4 +193,20 @@ public void initScanRefTableState(ServerContext context) {
     }
   }
 
+  public void initInstanceNameAndId(ZooReaderWriter zoo, InstanceId instanceId,

Review Comment:
   Is this called in a different class? I don't see this called in `ZooKeeperInitializer.initialize()` where I thought it would be called



##########
minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloClusterImpl.java:
##########
@@ -341,11 +341,11 @@ private ProcessInfo _exec(Class<?> clazz, List<String> extraJvmOpts, String... a
 
     // @formatter:off
     var hardcodedArgs = Stream.of(
-        "-Dapple.awt.UIElement=true",
-        "-Djava.net.preferIPv4Stack=true",
-        "-XX:+PerfDisableSharedMem",
-        "-XX:+AlwaysPreTouch",
-        Main.class.getName(), clazz.getName());
+            "-Dapple.awt.UIElement=true",
+            "-Djava.net.preferIPv4Stack=true",
+            "-XX:+PerfDisableSharedMem",
+            "-XX:+AlwaysPreTouch",
+            Main.class.getName(), clazz.getName());

Review Comment:
   Was there a reason for this change? Looks like an auto formatter change but the formatter is turned off above which is strange. I think this can be changed back



##########
server/base/src/main/java/org/apache/accumulo/server/util/TabletServerLocks.java:
##########
@@ -33,19 +33,18 @@ public class TabletServerLocks {
 
   public static void execute(final ServerContext context, final String lock, final String delete)
       throws Exception {
-    String tserverPath = context.getZooKeeperRoot() + Constants.ZTSERVERS;
 
     ZooCache cache = context.getZooCache();
     ZooReaderWriter zoo = context.getZooSession().asReaderWriter();
 
     if (delete == null) {
-      List<String> tabletServers = zoo.getChildren(tserverPath);
+      List<String> tabletServers = zoo.getChildren(Constants.ZTSERVERS);
       if (tabletServers.isEmpty()) {
-        System.err.println("No tservers found in ZK at " + tserverPath);
+        System.err.println("No tservers found in ZK at " + Constants.ZTSERVERS);

Review Comment:
   Probably still want to see the full path



##########
server/base/src/main/java/org/apache/accumulo/server/util/ServiceStatusCmd.java:
##########
@@ -59,19 +59,24 @@ public void execute(final ServerContext context, final boolean json, final boole
 
     ZooReader zooReader = context.getZooSession().asReader();
 
-    final String zooRoot = context.getZooKeeperRoot();
-    LOG.trace("zooRoot: {}", zooRoot);
+    LOG.trace("zooRoot: {}", "");

Review Comment:
   This log should be updated or removed



##########
server/compaction-coordinator/src/main/java/org/apache/accumulo/coordinator/CompactionCoordinator.java:
##########
@@ -210,7 +210,7 @@ protected void getCoordinatorLock(HostAndPort clientAddress)
     LOG.info("trying to get coordinator lock");
 
     final String coordinatorClientAddress = ExternalCompactionUtil.getHostPortString(clientAddress);
-    final String lockPath = getContext().getZooKeeperRoot() + Constants.ZCOORDINATOR_LOCK;
+    final String lockPath = Constants.ZCOORDINATOR_LOCK;

Review Comment:
   can be inlined



##########
server/compaction-coordinator/src/main/java/org/apache/accumulo/coordinator/CompactionCoordinator.java:
##########
@@ -750,7 +750,7 @@ private void deleteEmpty(ZooReaderWriter zoorw, String path)
   }
 
   private void cleanUpCompactors() {
-    final String compactorQueuesPath = getContext().getZooKeeperRoot() + Constants.ZCOMPACTORS;
+    final String compactorQueuesPath = Constants.ZCOMPACTORS;

Review Comment:
   can be inlined



##########
server/manager/src/main/java/org/apache/accumulo/manager/tableOps/namespace/create/PopulateZookeeperWithNamespace.java:
##########
@@ -53,9 +53,8 @@ public Repo<Manager> call(long tid, Manager manager) throws Exception {
     Utils.getTableNameLock().lock();
     try {
       var context = manager.getContext();
-      NamespaceMapping.put(context.getZooSession().asReaderWriter(),
-          context.getZooKeeperRoot() + Constants.ZNAMESPACES, namespaceInfo.namespaceId,
-          namespaceInfo.namespaceName);
+      NamespaceMapping.put(context.getZooSession().asReaderWriter(), Constants.ZNAMESPACES,
+          namespaceInfo.namespaceId, namespaceInfo.namespaceName);

Review Comment:
   Should probably avoid passing a constant



##########
server/base/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthorizor.java:
##########
@@ -41,16 +42,15 @@ public class ZKAuthorizor implements Authorizor {
   private static final Logger log = LoggerFactory.getLogger(ZKAuthorizor.class);
 
   private final String ZKUserAuths = "/Authorizations";
+  private final String zkUserPath = Constants.ZUSERS;

Review Comment:
   Same comment. Could also do the same for ZKUserAuths but that should probably be static not inlined



##########
server/base/src/main/java/org/apache/accumulo/server/security/handler/ZKPermHandler.java:
##########
@@ -54,21 +54,16 @@ public class ZKPermHandler implements PermissionHandler {
   private static final Logger log = LoggerFactory.getLogger(ZKPermHandler.class);
 
   private ZooReaderWriter zoo;
-  private String zkUserPath;
-  private String ZKTablePath;
-  private String ZKNamespacePath;
   private ZooCache zooCache;
   private final String ZKUserSysPerms = "/System";
   private final String ZKUserTablePerms = "/Tables";
   private final String ZKUserNamespacePerms = "/Namespaces";
+  private final String zkUserPath = Constants.ZUSERS;

Review Comment:
   These could all be changed to static. Can inline zkUserPath



##########
server/base/src/test/java/org/apache/accumulo/server/security/delegation/ZooAuthenticationKeyWatcherTest.java:
##########
@@ -70,7 +69,7 @@ public static void setupKeyGenerator() throws Exception {
 
   private ZooSession zk;
   private InstanceId instanceId;
-  private String baseNode;
+  private final String baseNode = Constants.ZDELEGATION_TOKEN_KEYS;

Review Comment:
   can be static or inlined



##########
server/base/src/main/java/org/apache/accumulo/server/util/ServiceStatusCmd.java:
##########
@@ -59,19 +59,24 @@ public void execute(final ServerContext context, final boolean json, final boole
 
     ZooReader zooReader = context.getZooSession().asReader();
 
-    final String zooRoot = context.getZooKeeperRoot();
-    LOG.trace("zooRoot: {}", zooRoot);
+    LOG.trace("zooRoot: {}", "");
 
     final Map<ServiceStatusReport.ReportKey,StatusSummary> services = new TreeMap<>();
 
-    services.put(ServiceStatusReport.ReportKey.MANAGER, getManagerStatus(zooReader, zooRoot));
-    services.put(ServiceStatusReport.ReportKey.MONITOR, getMonitorStatus(zooReader, zooRoot));
-    services.put(ServiceStatusReport.ReportKey.T_SERVER, getTServerStatus(zooReader, zooRoot));
-    services.put(ServiceStatusReport.ReportKey.S_SERVER, getScanServerStatus(zooReader, zooRoot));
-    services.put(ServiceStatusReport.ReportKey.COORDINATOR,
-        getCoordinatorStatus(zooReader, zooRoot));
-    services.put(ServiceStatusReport.ReportKey.COMPACTOR, getCompactorStatus(zooReader, zooRoot));
-    services.put(ServiceStatusReport.ReportKey.GC, getGcStatus(zooReader, zooRoot));
+    services.put(ServiceStatusReport.ReportKey.MANAGER, getStatusSummary(
+        ServiceStatusReport.ReportKey.MANAGER, zooReader, Constants.ZMANAGER_LOCK));
+    services.put(ServiceStatusReport.ReportKey.MONITOR, getStatusSummary(
+        ServiceStatusReport.ReportKey.MONITOR, zooReader, Constants.ZMONITOR_LOCK));
+    services.put(ServiceStatusReport.ReportKey.T_SERVER, getServerHostStatus(zooReader,
+        Constants.ZTSERVERS, ServiceStatusReport.ReportKey.T_SERVER, TSERV));
+    services.put(ServiceStatusReport.ReportKey.S_SERVER, getServerHostStatus(zooReader,
+        Constants.ZSSERVERS, ServiceStatusReport.ReportKey.S_SERVER, TABLET_SCAN));
+    services.put(ServiceStatusReport.ReportKey.COORDINATOR, getStatusSummary(
+        ServiceStatusReport.ReportKey.COORDINATOR, zooReader, Constants.ZCOORDINATOR_LOCK));
+    services.put(ServiceStatusReport.ReportKey.COMPACTOR,
+        getCompactorHosts(zooReader, Constants.ZCOMPACTORS));
+    services.put(ServiceStatusReport.ReportKey.GC,
+        getStatusSummary(ServiceStatusReport.ReportKey.GC, zooReader, Constants.ZGC_LOCK));

Review Comment:
   This is a nice improvement combining all those methods into one. Could push the Constant that is passed as an arg to instead be computed in the method. Could just add a switch which computes where the lock is... MANAGER -> ZMANAGER_LOCK, MONITOR -> ZMONITOR_LOCK etc. Similar thing for `getCompactorHosts` and `getServerHostStatus`



##########
server/manager/src/main/java/org/apache/accumulo/manager/upgrade/PreUpgradeValidation.java:
##########
@@ -88,7 +88,8 @@ private void validateACLs(ServerContext context) {
                 + "for instructions on how to fix.");
       }
     } catch (KeeperException | InterruptedException e) {
-      throw new RuntimeException("Upgrade Failed! Error validating nodes under " + rootPath, e);
+      throw new RuntimeException("Upgrade Failed! Error validating nodes under " + Constants.ZROOT,
+          e);

Review Comment:
   ZROOT = /accumulo
   Is this the correct error message we want here? Or should it be specific to the path to the instance



##########
server/base/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthenticator.java:
##########
@@ -41,16 +42,15 @@
 // Utility class for adding all authentication info into ZK
 public final class ZKAuthenticator implements Authenticator {
   private static final Logger log = LoggerFactory.getLogger(ZKAuthenticator.class);
+  private final String zkUserPath = Constants.ZUSERS;

Review Comment:
   This could be static or better yet just inlined everywhere it is used in this class



##########
server/base/src/main/java/org/apache/accumulo/server/manager/state/DeadServerList.java:
##########
@@ -38,29 +38,27 @@ public class DeadServerList {
 
   private static final Logger log = LoggerFactory.getLogger(DeadServerList.class);
 
-  private final String path;
   private final ZooReaderWriter zoo;
 
   public DeadServerList(ServerContext context) {
-    this.path = context.getZooKeeperRoot() + Constants.ZDEADTSERVERS;
     zoo = context.getZooSession().asReaderWriter();
     try {
-      zoo.mkdirs(path);
+      zoo.mkdirs(Constants.ZDEADTSERVERS);
     } catch (Exception ex) {
-      log.error("Unable to make parent directories of " + path, ex);
+      log.error("Unable to make parent directories of " + Constants.ZDEADTSERVERS, ex);

Review Comment:
   another place where we might still want the full path to be logged



##########
server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java:
##########
@@ -543,7 +543,7 @@ public void execute(final String[] args) {
           success = doInit(zk.asReaderWriter(), opts, fs, initConfig);
         }
       }
-    } catch (IOException e) {
+    } catch (IOException | InterruptedException | KeeperException e) {
       log.error("Problem trying to get Volume configuration", e);
       success = false;

Review Comment:
   It seems like new catch blocks should be added for these new exceptions from `doInit`



##########
minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloClusterImpl.java:
##########
@@ -681,9 +679,8 @@ private void verifyUp() throws InterruptedException, IOException {
       try {
         while (tsActualCount < tsExpectedCount) {
           tsActualCount = 0;
-          String tserverPath = rootPath + Constants.ZTSERVERS;
-          for (String child : rdr.getChildren(tserverPath)) {
-            if (rdr.getChildren(tserverPath + "/" + child).isEmpty()) {
+          for (String child : rdr.getChildren(rootPath + Constants.ZTSERVERS)) {
+            if (rdr.getChildren(rootPath + Constants.ZTSERVERS + "/" + child).isEmpty()) {

Review Comment:
   This section can be changed to what it was previously. Nicer to have the var here



##########
server/manager/src/main/java/org/apache/accumulo/manager/Manager.java:
##########
@@ -1297,20 +1293,20 @@ public void run() {
     ZooReaderWriter zReaderWriter = context.getZooSession().asReaderWriter();
 
     try {
-      zReaderWriter.getChildren(zroot + Constants.ZRECOVERY, new Watcher() {
+      zReaderWriter.getChildren(Constants.ZRECOVERY, new Watcher() {
         @Override
         public void process(WatchedEvent event) {
           nextEvent.event("Noticed recovery changes %s", event.getType());
           try {
             // watcher only fires once, add it back
-            zReaderWriter.getChildren(zroot + Constants.ZRECOVERY, this);
+            zReaderWriter.getChildren(Constants.ZRECOVERY, this);
           } catch (Exception e) {
             log.error("Failed to add log recovery watcher back", e);
           }
         }
       });
     } catch (KeeperException | InterruptedException e) {
-      throw new IllegalStateException("Unable to read " + zroot + Constants.ZRECOVERY, e);
+      throw new IllegalStateException("Unable to read " + Constants.ZRECOVERY, e);

Review Comment:
   Probably want full path here



##########
server/manager/src/main/java/org/apache/accumulo/manager/tableOps/namespace/rename/RenameNamespace.java:
##########
@@ -56,8 +56,7 @@ public Repo<Manager> call(long id, Manager manager) throws Exception {
 
     Utils.getTableNameLock().lock();
     try {
-      NamespaceMapping.rename(zoo, manager.getContext().getZooKeeperRoot() + Constants.ZNAMESPACES,
-          namespaceId, oldName, newName);
+      NamespaceMapping.rename(zoo, Constants.ZNAMESPACES, namespaceId, oldName, newName);

Review Comment:
   Should probably avoid passing a constant



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "ctubbsii (via GitHub)" <gi...@apache.org>.
ctubbsii commented on code in PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#discussion_r1992475598


##########
server/base/src/main/java/org/apache/accumulo/server/conf/util/ZooPropEditor.java:
##########
@@ -180,7 +179,8 @@ private void printProperties(final ServerContext context, final PropStoreKey<?>
       writer.printf(": Property scope: %s\n", scope);
       writer.printf(": ZooKeeper path: %s\n", propKey.getPath());
       writer.printf(": Name: %s\n", getDisplayName(propKey, context));
-      writer.printf(": Id: %s\n", propKey.getId());
+      writer.printf(": Id: %s\n", propKey instanceof IdBasedPropStoreKey
+          ? ((IdBasedPropStoreKey<?>) propKey).getId() : "N/A");

Review Comment:
   There is no such method. The "N/A" is specifically for the PropKey thatis *not* one that is id-based. So, there's no ID to print, and no canonical form of the ID. It simply doesn't apply to PropKeys that aren't based on an ID.



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "ctubbsii (via GitHub)" <gi...@apache.org>.
ctubbsii commented on PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#issuecomment-2719430920

   > 2\. Creating Constants.ZRELATIVE_ROOT to replace leading "/" in various places in the code.
   
   I'm not sure this one should be done. I think hiding the "/" behind a constant in the few places where it is needed makes those places less easy to read. I'd also avoid using words like "relative" or "absolute" when talking about paths, because those mean different things than what's happening here. Typically, an absolute path is one that starts with a slash and contains no relative path elements (e.g. `/` or `/path/to/someplace`), and relative paths contain dots or start with path names (e.g. `./`, `..`, `path/to/something`, or `/path/to/../something`). ZooKeeper does not use relative paths at all. However, the absolute paths it does use can be "relative" to a "chroot" absolute base path element. Referring to absolute paths as "relative" to another path can be confusing, even if one takes great care to be precise in the wording. I think it's better to just avoid it. The places where `/` are used as a leading path prefix, or complete path, are not common, but where they do occur, 
 they are typically more readable and obvious when seen as a string literal than when used as a constant.


-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "kevinrr888 (via GitHub)" <gi...@apache.org>.
kevinrr888 commented on code in PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#discussion_r1968049475


##########
server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java:
##########
@@ -543,7 +543,7 @@ public void execute(final String[] args) {
           success = doInit(zk.asReaderWriter(), opts, fs, initConfig);
         }
       }
-    } catch (IOException e) {
+    } catch (IOException | InterruptedException | KeeperException e) {
       log.error("Problem trying to get Volume configuration", e);
       success = false;

Review Comment:
   It seems like new catch blocks should be added to handle these new exceptions from `doInit`



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "meatballspaghetti (via GitHub)" <gi...@apache.org>.
meatballspaghetti commented on code in PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#discussion_r1974312206


##########
server/base/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthorizor.java:
##########
@@ -41,16 +42,15 @@ public class ZKAuthorizor implements Authorizor {
   private static final Logger log = LoggerFactory.getLogger(ZKAuthorizor.class);
 
   private final String ZKUserAuths = "/Authorizations";
+  private final String zkUserPath = Constants.ZUSERS;

Review Comment:
   Fixed, inlined it to stay consistent with the other related uses of Zookeeper constants.



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on code in PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#discussion_r1999483592


##########
server/base/src/main/java/org/apache/accumulo/server/constraints/MetadataConstraints.java:
##########
@@ -400,8 +400,7 @@ private void validateServerFamily(ArrayList<Short> violations, ColumnUpdate colu
         String lockId = new String(columnUpdate.getValue(), UTF_8);
 
         try {
-          lockHeld = ServiceLock.isLockHeld(context.getZooCache(),
-              new ZooUtil.LockID(context.getZooKeeperRoot(), lockId));
+          lockHeld = ServiceLock.isLockHeld(context.getZooCache(), new ZooUtil.LockID("", lockId));

Review Comment:
   It may have been a crude form of compression, removing the root path from persisted data because it was always the same.



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "meatballspaghetti (via GitHub)" <gi...@apache.org>.
meatballspaghetti commented on code in PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#discussion_r1998889913


##########
server/manager/src/main/java/org/apache/accumulo/manager/Manager.java:
##########
@@ -1288,20 +1284,20 @@ public void run() {
     ZooReaderWriter zReaderWriter = context.getZooSession().asReaderWriter();
 
     try {
-      zReaderWriter.getChildren(zroot + Constants.ZRECOVERY, new Watcher() {
+      zReaderWriter.getChildren(Constants.ZRECOVERY, new Watcher() {
         @Override
         public void process(WatchedEvent event) {
           nextEvent.event("Noticed recovery changes %s", event.getType());
           try {
             // watcher only fires once, add it back
-            zReaderWriter.getChildren(zroot + Constants.ZRECOVERY, this);
+            zReaderWriter.getChildren(Constants.ZRECOVERY, this);
           } catch (Exception e) {
             log.error("Failed to add log recovery watcher back", e);
           }
         }
       });
     } catch (KeeperException | InterruptedException e) {
-      throw new IllegalStateException("Unable to read " + zroot + Constants.ZRECOVERY, e);
+      throw new IllegalStateException("Unable to read " + Constants.ZRECOVERY, e);

Review Comment:
   Fixed to specify that what is being failed to be read is Constants.ZRECOVERY relative to the instance root node at `/accumulo/<uuid>`.



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "madrob (via GitHub)" <gi...@apache.org>.
madrob commented on PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#issuecomment-2695675180

   Oh cool, we are looking at this! 😎


-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "ctubbsii (via GitHub)" <gi...@apache.org>.
ctubbsii commented on code in PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#discussion_r1990300218


##########
server/base/src/main/java/org/apache/accumulo/server/conf/store/impl/PropStoreWatcher.java:
##########
@@ -100,15 +103,15 @@ public void process(final WatchedEvent event) {
       case NodeDataChanged:
         path = event.getPath();
         log.trace("handle change event for path: {}", path);
-        propStoreKey = PropStoreKey.fromPath(path);
+        propStoreKey = PropStoreKey.fromPath(path, instanceId);

Review Comment:
   I created an IT in 602fd4df7591971362373538df5c636d39b20bbc to verify the paths are relative.
   
   I also remember coming across a comment once in the ZK code that indicated some paths might be absolute. I've been looking at the ZK code pretty thoroughly, and I can't find it again. However, after looking at the ZK client code, and seeing all the places where they convert the client-side view of the path (relative to the chroot) to the server-side view of the path (the full path) and back again, and after verifying this integration test works in 3.6.1 and 3.9.2, I'm pretty confident that wherever that comment was, it was either wrong or did not apply to anything we care much about. I suspect that the comment might have been tied to a server-side logged message, or an Exception that got serialized with a path, because the chroot feature is implemented fully on the client side, so anything the server spits out... possibly including any KeeperException objects that are serialized and sent back to the client... might still have the full path. I checked our code, and I don't see any 
 critical use of KeeperException.getPath (just log messages).
   
   Additionally, the latest documentation at https://zookeeper.apache.org/doc/current/zookeeperProgrammers.html really emphasizes the ability to write relocatable code for different applications, chrooted to different parts of ZooKeeper. It would be really hard to do that if they didn't have guarantees. In any case, my integration test should help avoid the need to rely on confusing docs... it proves the current behavior and guards against any obvious change in behavior with respect to watchers and paths.



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "ctubbsii (via GitHub)" <gi...@apache.org>.
ctubbsii commented on code in PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#discussion_r1992465466


##########
server/base/src/main/java/org/apache/accumulo/server/conf/store/impl/ZooPropStore.java:
##########
@@ -85,33 +83,28 @@ public class ZooPropStore implements PropStore, PropChangeListener {
     } else {
       this.cache = new PropCacheCaffeineImpl.Builder(propLoader).forTests(ticker).build();
     }
-
     try {
-      var path = ZooUtil.getRoot(instanceId);
-      if (zrw.exists(path, propStoreWatcher)) {
-        log.debug("Have a ZooKeeper connection and found instance node: {}", instanceId);
+      if (zrw.exists("/", propStoreWatcher)) {

Review Comment:
   There should be very few places where "/" is used specifically. If we give it a name, it could be confusing, because it hides the obvious indicator that it exists only because paths always start with "/", and "/" refers to the top of the navigable hierarchy. Put behind a constant makes it confusing, I think.



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "dlmarion (via GitHub)" <gi...@apache.org>.
dlmarion commented on code in PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#discussion_r1967811855


##########
server/base/src/main/java/org/apache/accumulo/server/conf/store/impl/PropStoreWatcher.java:
##########
@@ -100,15 +103,15 @@ public void process(final WatchedEvent event) {
       case NodeDataChanged:
         path = event.getPath();
         log.trace("handle change event for path: {}", path);
-        propStoreKey = PropStoreKey.fromPath(path);
+        propStoreKey = PropStoreKey.fromPath(path, instanceId);

Review Comment:
   I'm curious about the event.path here. Is it the full path with the `/accumulo/<instanceId>` or is it relative?



##########
server/base/src/main/java/org/apache/accumulo/server/tables/TableManager.java:
##########
@@ -260,7 +252,7 @@ public void accept(WatchedEvent event) {
       final String zPath = event.getPath();

Review Comment:
   I have the same question here about the Watcher even path being full or relative.



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "ctubbsii (via GitHub)" <gi...@apache.org>.
ctubbsii commented on code in PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#discussion_r1999518640


##########
server/base/src/main/java/org/apache/accumulo/server/constraints/MetadataConstraints.java:
##########
@@ -400,8 +400,7 @@ private void validateServerFamily(ArrayList<Short> violations, ColumnUpdate colu
         String lockId = new String(columnUpdate.getValue(), UTF_8);
 
         try {
-          lockHeld = ServiceLock.isLockHeld(context.getZooCache(),
-              new ZooUtil.LockID(context.getZooKeeperRoot(), lockId));
+          lockHeld = ServiceLock.isLockHeld(context.getZooCache(), new ZooUtil.LockID("", lockId));

Review Comment:
   I noticed that some representations also omit the leading slash, so it's not clear to me if it the `/root/` is always stripped, or only `/root`. I also don't know if all the places where this is persisted, to ensure we cover all the edge cases during an upgrade.



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "meatballspaghetti (via GitHub)" <gi...@apache.org>.
meatballspaghetti commented on code in PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#discussion_r1977609128


##########
minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloClusterImpl.java:
##########
@@ -341,11 +341,11 @@ private ProcessInfo _exec(Class<?> clazz, List<String> extraJvmOpts, String... a
 
     // @formatter:off
     var hardcodedArgs = Stream.of(
-        "-Dapple.awt.UIElement=true",
-        "-Djava.net.preferIPv4Stack=true",
-        "-XX:+PerfDisableSharedMem",
-        "-XX:+AlwaysPreTouch",
-        Main.class.getName(), clazz.getName());
+            "-Dapple.awt.UIElement=true",
+            "-Djava.net.preferIPv4Stack=true",
+            "-XX:+PerfDisableSharedMem",
+            "-XX:+AlwaysPreTouch",
+            Main.class.getName(), clazz.getName());

Review Comment:
   Changed it back. It might be something to do with how my IDE formats things (despite our auto formatter) - I'll keep an eye on it in following commits to make sure it doesn't do that again.



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "ctubbsii (via GitHub)" <gi...@apache.org>.
ctubbsii commented on code in PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#discussion_r1972465412


##########
core/src/main/java/org/apache/accumulo/core/metadata/schema/TabletMetadata.java:
##########
@@ -534,12 +534,10 @@ static TabletMetadata create(String id, String prevEndRow, String endRow) {
   public static synchronized Set<TServerInstance> getLiveTServers(ClientContext context) {
     final Set<TServerInstance> liveServers = new HashSet<>();
 
-    final String path = context.getZooKeeperRoot() + Constants.ZTSERVERS;
-
-    for (String child : context.getZooCache().getChildren(path)) {
-      checkServer(context, path, child).ifPresent(liveServers::add);
+    for (String child : context.getZooCache().getChildren(Constants.ZTSERVERS)) {
+      checkServer(context, Constants.ZTSERVERS, child).ifPresent(liveServers::add);
     }
-    log.trace("Found {} live tservers at ZK path: {}", liveServers.size(), path);
+    log.trace("Found {} live tservers at ZK path: {}", liveServers.size(), Constants.ZTSERVERS);

Review Comment:
   The whole point of this is to avoid passing around the pieces of the path that we don't need to pass around, like instanceId. So, there is no full path to get... it's always a path relative to the ZooKeeper connectString. So, the constant *is* the full path (at least, the full path that any of this code has any knowledge of).



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "ctubbsii (via GitHub)" <gi...@apache.org>.
ctubbsii commented on PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#issuecomment-2686276195

   @meatballspaghetti I pushed a few commits onto this that merged the latest 3.1 onto this branch, and also fixed some additional issues with some of the prop store and prop store related tests.


-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "meatballspaghetti (via GitHub)" <gi...@apache.org>.
meatballspaghetti commented on code in PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#discussion_r1974315385


##########
server/manager/src/main/java/org/apache/accumulo/manager/tableOps/namespace/rename/RenameNamespace.java:
##########
@@ -56,8 +56,7 @@ public Repo<Manager> call(long id, Manager manager) throws Exception {
 
     Utils.getTableNameLock().lock();
     try {
-      NamespaceMapping.rename(zoo, manager.getContext().getZooKeeperRoot() + Constants.ZNAMESPACES,
-          namespaceId, oldName, newName);
+      NamespaceMapping.rename(zoo, Constants.ZNAMESPACES, namespaceId, oldName, newName);

Review Comment:
   Fixed.



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "dlmarion (via GitHub)" <gi...@apache.org>.
dlmarion commented on code in PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#discussion_r1992107291


##########
server/base/src/main/java/org/apache/accumulo/server/conf/util/ZooPropEditor.java:
##########
@@ -180,7 +179,8 @@ private void printProperties(final ServerContext context, final PropStoreKey<?>
       writer.printf(": Property scope: %s\n", scope);
       writer.printf(": ZooKeeper path: %s\n", propKey.getPath());
       writer.printf(": Name: %s\n", getDisplayName(propKey, context));
-      writer.printf(": Id: %s\n", propKey.getId());
+      writer.printf(": Id: %s\n", propKey instanceof IdBasedPropStoreKey
+          ? ((IdBasedPropStoreKey<?>) propKey).getId() : "N/A");

Review Comment:
   Why print "N/A" here? Could print `propKey.canonical()`, right?



##########
server/base/src/main/java/org/apache/accumulo/server/conf/store/impl/ZooPropStore.java:
##########
@@ -85,33 +83,28 @@ public class ZooPropStore implements PropStore, PropChangeListener {
     } else {
       this.cache = new PropCacheCaffeineImpl.Builder(propLoader).forTests(ticker).build();
     }
-
     try {
-      var path = ZooUtil.getRoot(instanceId);
-      if (zrw.exists(path, propStoreWatcher)) {
-        log.debug("Have a ZooKeeper connection and found instance node: {}", instanceId);
+      if (zrw.exists("/", propStoreWatcher)) {
+        log.debug("Have a ZooKeeper connection and found instance node: {}");
         zkReadyMon.setReady();
       } else {
-        throw new IllegalStateException("Instance may not have been initialized, root node: " + path
-            + " does not exist in ZooKeeper");
+        throw new IllegalStateException(
+            "Instance may not have been initialized, provided root node path does not exist in ZooKeeper");
       }
     } catch (InterruptedException ex) {
       Thread.currentThread().interrupt();
-      throw new IllegalStateException(
-          "Interrupted trying to read root node " + instanceId + " from ZooKeeper", ex);
+      throw new IllegalStateException("Interrupted trying to read root node from ZooKeeper", ex);
     } catch (KeeperException ex) {
-      throw new IllegalStateException("Failed to read root node " + instanceId + " from ZooKeeper",
-          ex);
+      throw new IllegalStateException("Failed to read root node from ZooKeeper", ex);

Review Comment:
   Same comment applies here about the root node.



##########
server/base/src/main/java/org/apache/accumulo/server/conf/store/impl/ZooPropStore.java:
##########
@@ -85,33 +83,28 @@ public class ZooPropStore implements PropStore, PropChangeListener {
     } else {
       this.cache = new PropCacheCaffeineImpl.Builder(propLoader).forTests(ticker).build();
     }
-
     try {
-      var path = ZooUtil.getRoot(instanceId);
-      if (zrw.exists(path, propStoreWatcher)) {
-        log.debug("Have a ZooKeeper connection and found instance node: {}", instanceId);
+      if (zrw.exists("/", propStoreWatcher)) {
+        log.debug("Have a ZooKeeper connection and found instance node: {}");
         zkReadyMon.setReady();
       } else {
-        throw new IllegalStateException("Instance may not have been initialized, root node: " + path
-            + " does not exist in ZooKeeper");
+        throw new IllegalStateException(
+            "Instance may not have been initialized, provided root node path does not exist in ZooKeeper");
       }
     } catch (InterruptedException ex) {
       Thread.currentThread().interrupt();
-      throw new IllegalStateException(
-          "Interrupted trying to read root node " + instanceId + " from ZooKeeper", ex);
+      throw new IllegalStateException("Interrupted trying to read root node from ZooKeeper", ex);

Review Comment:
   This message is a little misleading. Root node with no context means '/', when in reality you can't read the instance root node which is at `/accumulo/<uuid>`.



##########
server/manager/src/main/java/org/apache/accumulo/manager/Manager.java:
##########
@@ -1288,20 +1284,20 @@ public void run() {
     ZooReaderWriter zReaderWriter = context.getZooSession().asReaderWriter();
 
     try {
-      zReaderWriter.getChildren(zroot + Constants.ZRECOVERY, new Watcher() {
+      zReaderWriter.getChildren(Constants.ZRECOVERY, new Watcher() {
         @Override
         public void process(WatchedEvent event) {
           nextEvent.event("Noticed recovery changes %s", event.getType());
           try {
             // watcher only fires once, add it back
-            zReaderWriter.getChildren(zroot + Constants.ZRECOVERY, this);
+            zReaderWriter.getChildren(Constants.ZRECOVERY, this);
           } catch (Exception e) {
             log.error("Failed to add log recovery watcher back", e);
           }
         }
       });
     } catch (KeeperException | InterruptedException e) {
-      throw new IllegalStateException("Unable to read " + zroot + Constants.ZRECOVERY, e);
+      throw new IllegalStateException("Unable to read " + Constants.ZRECOVERY, e);

Review Comment:
   Same comment here about the path in zookeeper not being entirely correct in the log or error message. 



##########
server/base/src/main/java/org/apache/accumulo/server/conf/store/impl/ZooPropStore.java:
##########
@@ -85,33 +83,28 @@ public class ZooPropStore implements PropStore, PropChangeListener {
     } else {
       this.cache = new PropCacheCaffeineImpl.Builder(propLoader).forTests(ticker).build();
     }
-
     try {
-      var path = ZooUtil.getRoot(instanceId);
-      if (zrw.exists(path, propStoreWatcher)) {
-        log.debug("Have a ZooKeeper connection and found instance node: {}", instanceId);
+      if (zrw.exists("/", propStoreWatcher)) {

Review Comment:
   "/" has me wondering after this change in how many places Constants.ZROOT is used. If localized to one class to get the instanceId, then maybe Constants.ZROOT should be removed or moved into that class. Maybe '/' should become `Constants.ZINSTANCE_ROOT`.



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "ctubbsii (via GitHub)" <gi...@apache.org>.
ctubbsii commented on code in PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#discussion_r1992475598


##########
server/base/src/main/java/org/apache/accumulo/server/conf/util/ZooPropEditor.java:
##########
@@ -180,7 +179,8 @@ private void printProperties(final ServerContext context, final PropStoreKey<?>
       writer.printf(": Property scope: %s\n", scope);
       writer.printf(": ZooKeeper path: %s\n", propKey.getPath());
       writer.printf(": Name: %s\n", getDisplayName(propKey, context));
-      writer.printf(": Id: %s\n", propKey.getId());
+      writer.printf(": Id: %s\n", propKey instanceof IdBasedPropStoreKey
+          ? ((IdBasedPropStoreKey<?>) propKey).getId() : "N/A");

Review Comment:
   There is no such method. The "N/A" is specifically for the PropKey that is *not* one that is id-based. So, there's no ID to print, and no canonical form of the ID. It simply doesn't apply to PropKeys that aren't based on an ID.
   
   The history of this is that the the PropKey was built around AbstractId. While this makes sense for namespace and table prop keys, the system prop key had a hack to base it on the InstanceId (which is an AbstractId). However, with the removal of instance IDs from the PropKey entirely, it no longer makes sense to have it based on the AbstractId. So, I helped @meatballspaghetti by modifying this code to distinguish between PropKeys that are based on AbstractId and those that aren't (like the system prop key), and made the canonical representation of PropKey the associated path, rather than any associated abstract ID (which does not always exist).



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "ctubbsii (via GitHub)" <gi...@apache.org>.
ctubbsii commented on code in PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#discussion_r1999472876


##########
server/manager/src/main/java/org/apache/accumulo/manager/Manager.java:
##########
@@ -1288,20 +1284,20 @@ public void run() {
     ZooReaderWriter zReaderWriter = context.getZooSession().asReaderWriter();
 
     try {
-      zReaderWriter.getChildren(zroot + Constants.ZRECOVERY, new Watcher() {
+      zReaderWriter.getChildren(Constants.ZRECOVERY, new Watcher() {
         @Override
         public void process(WatchedEvent event) {
           nextEvent.event("Noticed recovery changes %s", event.getType());
           try {
             // watcher only fires once, add it back
-            zReaderWriter.getChildren(zroot + Constants.ZRECOVERY, this);
+            zReaderWriter.getChildren(Constants.ZRECOVERY, this);
           } catch (Exception e) {
             log.error("Failed to add log recovery watcher back", e);
           }
         }
       });
     } catch (KeeperException | InterruptedException e) {
-      throw new IllegalStateException("Unable to read " + zroot + Constants.ZRECOVERY, e);
+      throw new IllegalStateException("Unable to read " + Constants.ZRECOVERY, e);

Review Comment:
   @meatballspaghetti added a more verbose comment to explain that ZRECOVERY was a partial path. However, I reverted it because this log is not particularly unique... we have lots of logs that are going to display paths from ZK, and we don't want to explain that on every one, and trying to figure out which ones should have it and which ones shouldn't is going to be very tedious... and might require passing around the instanceId or root path again, just for log messages. I think the shorter paths are going to take some getting used to, but I don't think it's worth keeping around all the extra code passing around these things just for log messages.



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "ctubbsii (via GitHub)" <gi...@apache.org>.
ctubbsii commented on code in PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#discussion_r1999476986


##########
server/base/src/main/java/org/apache/accumulo/server/constraints/MetadataConstraints.java:
##########
@@ -400,8 +400,7 @@ private void validateServerFamily(ArrayList<Short> violations, ColumnUpdate colu
         String lockId = new String(columnUpdate.getValue(), UTF_8);
 
         try {
-          lockHeld = ServiceLock.isLockHeld(context.getZooCache(),
-              new ZooUtil.LockID(context.getZooKeeperRoot(), lockId));
+          lockHeld = ServiceLock.isLockHeld(context.getZooCache(), new ZooUtil.LockID("", lockId));

Review Comment:
   I completely agree. It's very confusing to me as well. I made an attempt to improve it, but I wasn't really sure the full intent of the code paths in the serialization/deserialization, as the intent of the current behavior is not documented.



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "ctubbsii (via GitHub)" <gi...@apache.org>.
ctubbsii commented on code in PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#discussion_r1999487119


##########
server/base/src/main/java/org/apache/accumulo/server/conf/util/ZooInfoViewer.java:
##########
@@ -231,13 +231,11 @@ private void printAcls(final ServerContext context, final Opts opts, final Print
     var conf = opts.getSiteConfiguration();
     try (var zk = new ZooSession(getClass().getSimpleName(), conf)) {
 
-      String instanceRoot = ZooUtil.getRoot(iid);
-
       final Stat stat = new Stat();
 
       recursiveAclRead(zk, ZROOT + ZINSTANCES, stat, aclMap);
 
-      recursiveAclRead(zk, instanceRoot, stat, aclMap);
+      recursiveAclRead(zk, "/", stat, aclMap);

Review Comment:
   You are correct. I fixed it in c6ab0db894bd47a2c3cb458e9753c29d9ea33e52



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "meatballspaghetti (via GitHub)" <gi...@apache.org>.
meatballspaghetti commented on code in PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#discussion_r1974314882


##########
server/base/src/main/java/org/apache/accumulo/server/util/ServiceStatusCmd.java:
##########
@@ -59,19 +59,24 @@ public void execute(final ServerContext context, final boolean json, final boole
 
     ZooReader zooReader = context.getZooSession().asReader();
 
-    final String zooRoot = context.getZooKeeperRoot();
-    LOG.trace("zooRoot: {}", zooRoot);
+    LOG.trace("zooRoot: {}", "");
 
     final Map<ServiceStatusReport.ReportKey,StatusSummary> services = new TreeMap<>();
 
-    services.put(ServiceStatusReport.ReportKey.MANAGER, getManagerStatus(zooReader, zooRoot));
-    services.put(ServiceStatusReport.ReportKey.MONITOR, getMonitorStatus(zooReader, zooRoot));
-    services.put(ServiceStatusReport.ReportKey.T_SERVER, getTServerStatus(zooReader, zooRoot));
-    services.put(ServiceStatusReport.ReportKey.S_SERVER, getScanServerStatus(zooReader, zooRoot));
-    services.put(ServiceStatusReport.ReportKey.COORDINATOR,
-        getCoordinatorStatus(zooReader, zooRoot));
-    services.put(ServiceStatusReport.ReportKey.COMPACTOR, getCompactorStatus(zooReader, zooRoot));
-    services.put(ServiceStatusReport.ReportKey.GC, getGcStatus(zooReader, zooRoot));
+    services.put(ServiceStatusReport.ReportKey.MANAGER, getStatusSummary(
+        ServiceStatusReport.ReportKey.MANAGER, zooReader, Constants.ZMANAGER_LOCK));
+    services.put(ServiceStatusReport.ReportKey.MONITOR, getStatusSummary(
+        ServiceStatusReport.ReportKey.MONITOR, zooReader, Constants.ZMONITOR_LOCK));
+    services.put(ServiceStatusReport.ReportKey.T_SERVER, getServerHostStatus(zooReader,
+        Constants.ZTSERVERS, ServiceStatusReport.ReportKey.T_SERVER, TSERV));
+    services.put(ServiceStatusReport.ReportKey.S_SERVER, getServerHostStatus(zooReader,
+        Constants.ZSSERVERS, ServiceStatusReport.ReportKey.S_SERVER, TABLET_SCAN));
+    services.put(ServiceStatusReport.ReportKey.COORDINATOR, getStatusSummary(
+        ServiceStatusReport.ReportKey.COORDINATOR, zooReader, Constants.ZCOORDINATOR_LOCK));
+    services.put(ServiceStatusReport.ReportKey.COMPACTOR,
+        getCompactorHosts(zooReader, Constants.ZCOMPACTORS));
+    services.put(ServiceStatusReport.ReportKey.GC,
+        getStatusSummary(ServiceStatusReport.ReportKey.GC, zooReader, Constants.ZGC_LOCK));

Review Comment:
   Fixed. Added a mapping of ReportKeys to ZKPath Constants to `ServiceStatusReport` to be able to get the path that matches the ReportKey from within the `ServiceStatusCmd `methods.



##########
server/compaction-coordinator/src/main/java/org/apache/accumulo/coordinator/CompactionCoordinator.java:
##########
@@ -210,7 +210,7 @@ protected void getCoordinatorLock(HostAndPort clientAddress)
     LOG.info("trying to get coordinator lock");
 
     final String coordinatorClientAddress = ExternalCompactionUtil.getHostPortString(clientAddress);
-    final String lockPath = getContext().getZooKeeperRoot() + Constants.ZCOORDINATOR_LOCK;
+    final String lockPath = Constants.ZCOORDINATOR_LOCK;

Review Comment:
   Fixed.



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "meatballspaghetti (via GitHub)" <gi...@apache.org>.
meatballspaghetti commented on code in PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#discussion_r1974315220


##########
server/compaction-coordinator/src/main/java/org/apache/accumulo/coordinator/CompactionCoordinator.java:
##########
@@ -750,7 +750,7 @@ private void deleteEmpty(ZooReaderWriter zoorw, String path)
   }
 
   private void cleanUpCompactors() {
-    final String compactorQueuesPath = getContext().getZooKeeperRoot() + Constants.ZCOMPACTORS;
+    final String compactorQueuesPath = Constants.ZCOMPACTORS;

Review Comment:
   Fixed.



##########
server/manager/src/main/java/org/apache/accumulo/manager/tableOps/namespace/create/PopulateZookeeperWithNamespace.java:
##########
@@ -53,9 +53,8 @@ public Repo<Manager> call(long tid, Manager manager) throws Exception {
     Utils.getTableNameLock().lock();
     try {
       var context = manager.getContext();
-      NamespaceMapping.put(context.getZooSession().asReaderWriter(),
-          context.getZooKeeperRoot() + Constants.ZNAMESPACES, namespaceInfo.namespaceId,
-          namespaceInfo.namespaceName);
+      NamespaceMapping.put(context.getZooSession().asReaderWriter(), Constants.ZNAMESPACES,
+          namespaceInfo.namespaceId, namespaceInfo.namespaceName);

Review Comment:
   Fixed.



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "meatballspaghetti (via GitHub)" <gi...@apache.org>.
meatballspaghetti commented on code in PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#discussion_r1974312206


##########
server/base/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthorizor.java:
##########
@@ -41,16 +42,15 @@ public class ZKAuthorizor implements Authorizor {
   private static final Logger log = LoggerFactory.getLogger(ZKAuthorizor.class);
 
   private final String ZKUserAuths = "/Authorizations";
+  private final String zkUserPath = Constants.ZUSERS;

Review Comment:
   Fixed, inlined it to stay consistent with the other related uses of Zookeeper constants.



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "meatballspaghetti (via GitHub)" <gi...@apache.org>.
meatballspaghetti commented on code in PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#discussion_r1974311597


##########
server/base/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthenticator.java:
##########
@@ -41,16 +42,15 @@
 // Utility class for adding all authentication info into ZK
 public final class ZKAuthenticator implements Authenticator {
   private static final Logger log = LoggerFactory.getLogger(ZKAuthenticator.class);
+  private final String zkUserPath = Constants.ZUSERS;

Review Comment:
   Fixed, inlined it.



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "dlmarion (via GitHub)" <gi...@apache.org>.
dlmarion commented on PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#issuecomment-2721014832

   > I'd also avoid using words like "relative" or "absolute" when talking about paths, because those mean different things than what's happening here. 
   
   Yeah, maybe ZINSTANCE_ROOT is a better  name
   
   


-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "ctubbsii (via GitHub)" <gi...@apache.org>.
ctubbsii commented on PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#issuecomment-2730607163

   > > I'd also avoid using words like "relative" or "absolute" when talking about paths, because those mean different things than what's happening here.
   > 
   > Yeah, maybe ZINSTANCE_ROOT is a better name
   
   I agree that is a much better name. If we have need of it, I think that's a good choice to use. However, I still don't see much value in making a `Constants.ZINSTANCE_ROOT` when `"/"` will suffice and is almost always more clear.


-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "ctubbsii (via GitHub)" <gi...@apache.org>.
ctubbsii commented on code in PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#discussion_r1990301760


##########
server/base/src/main/java/org/apache/accumulo/server/tables/TableManager.java:
##########
@@ -260,7 +252,7 @@ public void accept(WatchedEvent event) {
       final String zPath = event.getPath();

Review Comment:
   I created an IT in 602fd4df7591971362373538df5c636d39b20bbc to verify the paths are relative. (see earlier comment about the same).



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "ctubbsii (via GitHub)" <gi...@apache.org>.
ctubbsii commented on code in PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#discussion_r1992473343


##########
server/base/src/main/java/org/apache/accumulo/server/conf/store/impl/ZooPropStore.java:
##########
@@ -85,33 +83,28 @@ public class ZooPropStore implements PropStore, PropChangeListener {
     } else {
       this.cache = new PropCacheCaffeineImpl.Builder(propLoader).forTests(ticker).build();
     }
-
     try {
-      var path = ZooUtil.getRoot(instanceId);
-      if (zrw.exists(path, propStoreWatcher)) {
-        log.debug("Have a ZooKeeper connection and found instance node: {}", instanceId);
+      if (zrw.exists("/", propStoreWatcher)) {

Review Comment:
   In this case, I think it's not particularly useful for checking whether `/` exists (it can't not exist). So, whatever this code is trying to do, maybe it can be done differently than this.



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "meatballspaghetti (via GitHub)" <gi...@apache.org>.
meatballspaghetti commented on code in PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#discussion_r1974308865


##########
server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java:
##########
@@ -543,7 +543,7 @@ public void execute(final String[] args) {
           success = doInit(zk.asReaderWriter(), opts, fs, initConfig);
         }
       }
-    } catch (IOException e) {
+    } catch (IOException | InterruptedException | KeeperException e) {
       log.error("Problem trying to get Volume configuration", e);
       success = false;

Review Comment:
   Fixed, added separate catch blocks for each exception.



##########
server/base/src/main/java/org/apache/accumulo/server/init/ZooKeeperInitializer.java:
##########
@@ -79,40 +79,29 @@ void initializeConfig(final InstanceId instanceId, final ZooReaderWriter zoo) {
       if (zoo.exists(sysPropPath)) {
         return;
       }
-      var created = zoo.putPrivatePersistentData(sysPropPath,
+      var created = zoo.putPrivatePersistentData(zkInstanceRoot + sysPropPath,
           VersionedPropCodec.getDefault().toBytes(vProps), ZooUtil.NodeExistsPolicy.FAIL);
       if (!created) {
         throw new IllegalStateException(
             "Failed to create default system props during initialization at: {}" + sysPropPath);
       }
+      // if (!zoo.exists("/yea")) {
+      // throw new IllegalStateException("heres the stuff under root/iid/config: "
+      // + Arrays.toString(zoo.getData(zkInstanceRoot + Constants.ZCONFIG)));
+      // }

Review Comment:
   Fixed.



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "meatballspaghetti (via GitHub)" <gi...@apache.org>.
meatballspaghetti commented on code in PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#discussion_r1974308196


##########
minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloClusterImpl.java:
##########
@@ -681,9 +679,8 @@ private void verifyUp() throws InterruptedException, IOException {
       try {
         while (tsActualCount < tsExpectedCount) {
           tsActualCount = 0;
-          String tserverPath = rootPath + Constants.ZTSERVERS;
-          for (String child : rdr.getChildren(tserverPath)) {
-            if (rdr.getChildren(tserverPath + "/" + child).isEmpty()) {
+          for (String child : rdr.getChildren(rootPath + Constants.ZTSERVERS)) {
+            if (rdr.getChildren(rootPath + Constants.ZTSERVERS + "/" + child).isEmpty()) {

Review Comment:
   Fixed.



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "meatballspaghetti (via GitHub)" <gi...@apache.org>.
meatballspaghetti commented on code in PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#discussion_r1974311358


##########
server/base/src/main/java/org/apache/accumulo/server/init/ZooKeeperInitializer.java:
##########
@@ -205,4 +193,20 @@ public void initScanRefTableState(ServerContext context) {
     }
   }
 
+  public void initInstanceNameAndId(ZooReaderWriter zoo, InstanceId instanceId,

Review Comment:
   This is called in `Initialize.java` in `doInit()`.



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "ctubbsii (via GitHub)" <gi...@apache.org>.
ctubbsii merged PR #5350:
URL: https://github.com/apache/accumulo/pull/5350


-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on code in PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#discussion_r1999382209


##########
server/base/src/main/java/org/apache/accumulo/server/conf/util/ZooInfoViewer.java:
##########
@@ -231,13 +231,11 @@ private void printAcls(final ServerContext context, final Opts opts, final Print
     var conf = opts.getSiteConfiguration();
     try (var zk = new ZooSession(getClass().getSimpleName(), conf)) {
 
-      String instanceRoot = ZooUtil.getRoot(iid);
-
       final Stat stat = new Stat();
 
       recursiveAclRead(zk, ZROOT + ZINSTANCES, stat, aclMap);
 
-      recursiveAclRead(zk, instanceRoot, stat, aclMap);
+      recursiveAclRead(zk, "/", stat, aclMap);

Review Comment:
   Not sure but suspect this behavior may differ.  Is this zookeeper chrooted?  If not is this reading all of zookeeper when it looks like it used to read a single instances data?



##########
server/base/src/main/java/org/apache/accumulo/server/constraints/MetadataConstraints.java:
##########
@@ -400,8 +400,7 @@ private void validateServerFamily(ArrayList<Short> violations, ColumnUpdate colu
         String lockId = new String(columnUpdate.getValue(), UTF_8);
 
         try {
-          lockHeld = ServiceLock.isLockHeld(context.getZooCache(),
-              new ZooUtil.LockID(context.getZooKeeperRoot(), lockId));
+          lockHeld = ServiceLock.isLockHeld(context.getZooCache(), new ZooUtil.LockID("", lockId));

Review Comment:
   Seems like LockId used to strip the root and add it back.  Now its mostly stripping `/` and its kinda confusing, would be good to clean this behavior up in a follow on PR.



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "ctubbsii (via GitHub)" <gi...@apache.org>.
ctubbsii commented on code in PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#discussion_r1992475598


##########
server/base/src/main/java/org/apache/accumulo/server/conf/util/ZooPropEditor.java:
##########
@@ -180,7 +179,8 @@ private void printProperties(final ServerContext context, final PropStoreKey<?>
       writer.printf(": Property scope: %s\n", scope);
       writer.printf(": ZooKeeper path: %s\n", propKey.getPath());
       writer.printf(": Name: %s\n", getDisplayName(propKey, context));
-      writer.printf(": Id: %s\n", propKey.getId());
+      writer.printf(": Id: %s\n", propKey instanceof IdBasedPropStoreKey
+          ? ((IdBasedPropStoreKey<?>) propKey).getId() : "N/A");

Review Comment:
   There is no such method. The "N/A" is specifically for the PropKey that is *not* one that is id-based. So, there's no ID to print, and no canonical form of the ID. It simply doesn't apply to PropKeys that aren't based on an ID.



-- 
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-unsubscribe@accumulo.apache.org

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


Re: [PR] "Chroot" ZooKeeper to base directory instead of specifying full path [accumulo]

Posted by "ctubbsii (via GitHub)" <gi...@apache.org>.
ctubbsii commented on PR #5350:
URL: https://github.com/apache/accumulo/pull/5350#issuecomment-2722944003

   I updated this PR with the staged changes in the branch labeled `zkchroot-merge-main` and also merged in main, and set the base branch to main.


-- 
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-unsubscribe@accumulo.apache.org

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