dlmarion commented on code in PR #3118:
URL: https://github.com/apache/accumulo/pull/3118#discussion_r1046145303
##########
core/src/main/java/org/apache/accumulo/core/fate/zookeeper/ZooReader.java:
##########
@@ -121,6 +123,36 @@ public boolean exists(String zPath, Watcher watcher)
return getStatus(zPath, watcher) != null;
}
+ /**
+ * read the ZooKeeper acls for a node.
+ */
+ public List<ACL> getAcls(String zPath, Stat stat) throws KeeperException,
InterruptedException {
+ requireNonNull(stat); // required for ZooKeeper 3.4
+ return retryLoop(zk -> zk.getACL(zPath, stat));
+ }
+
+ public void recursiveAclRead(String parentPath, Map<String,List<ACL>> acls) {
+ try {
+
+ Stat dummy = new Stat(); // required form ZooKeeper 3.4 compatibility,
unused here.
+ acls.put(parentPath, getAcls(parentPath, dummy));
+
+ for (String child : getChildren(parentPath)) {
+ String childPath = parentPath + "/" + child;
+ List<ACL> acl = getAcls(childPath, dummy);
+ acls.put(childPath, acl);
+ recursiveAclRead(childPath, acls);
Review Comment:
You could alternatively use `ZKUtil.visitSubTreeDFS`. See
Upgrader9To10.validateACLs for an example.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]