kevinrr888 commented on code in PR #5728:
URL: https://github.com/apache/accumulo/pull/5728#discussion_r2200812452


##########
core/src/main/java/org/apache/accumulo/core/fate/ZooStore.java:
##########
@@ -130,6 +136,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<>(zc.getChildren(path));
+          Collections.sort(txdirs);

Review Comment:
   is sorting still necessary?



##########
core/src/main/java/org/apache/accumulo/core/fate/ZooStore.java:
##########
@@ -130,6 +136,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();

Review Comment:
   Could we just sync on the zoostore/this instead? Would be nice to avoid a 
second lock



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