keith-turner commented on code in PR #5728:
URL: https://github.com/apache/accumulo/pull/5728#discussion_r2195297046


##########
core/src/main/java/org/apache/accumulo/core/fate/ZooStore.java:
##########
@@ -130,6 +133,31 @@ public long create() {
     }
   }
 
+  /*
+   * Holds a copy of all of the fate transaction in zookeeper. Used for 
finding the next one to
+   * reserve. When empty a single thread will refill. All fate threads can 
pull off of the queue as
+   * they look for something to reserve. This is used so that each thread does 
not have to read all
+   * children from zookeeper when looking for any fate tx to reserve.
+   */
+  private final Queue<String> reservationCandidates = new 
ConcurrentLinkedQueue<>();
+  private final Lock reservationCandidateLock = new ReentrantLock();
+
+  private Queue<String> getTxDirs() throws InterruptedException, 
KeeperException {
+    if (reservationCandidates.isEmpty()) {
+      reservationCandidateLock.lock();
+      try {
+        if (reservationCandidates.isEmpty()) {
+          List<String> txdirs = new ArrayList<>(zk.getChildren(path));

Review Comment:
   This refill of the queue could use zoocache.  That would avoid trips to 
zookeeper when the set of children is not changing.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

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

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

Reply via email to