keith-turner commented on code in PR #5728: URL: https://github.com/apache/accumulo/pull/5728#discussion_r2200932632
########## 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: Its not necessary, but it seems like it will make things a bit more predicable. We do not know what order things are coming back from ZK. If ZK is using a hash set on the server side, then the order could be random and fluctuate over time as the set changes. Sorting makes it so that for each pass through all of the tx ids that individual tx ids are are roughly the same place in the list. -- 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