belliottsmith commented on code in PR #3431:
URL: https://github.com/apache/cassandra/pull/3431#discussion_r1686579384


##########
src/java/org/apache/cassandra/journal/Journal.java:
##########
@@ -112,31 +116,92 @@ public class Journal<K, V> implements Shutdownable
     private final WaitQueue segmentPrepared = newWaitQueue();
     private final WaitQueue allocatorThreadWaitQueue = newWaitQueue();
     private final BooleanSupplier allocatorThreadWaitCondition = () -> 
(availableSegment == null);
+    private final FlusherCallbacks flusherCallbacks;
 
     SequentialExecutorPlus closer;
     //private final Set<Descriptor> invalidations = 
Collections.newSetFromMap(new ConcurrentHashMap<>());
 
+    private class FlusherCallbacks implements Flusher.Callbacks
+    {
+        private final Queue<WaitingFor> waitingFor = new 
ConcurrentLinkedQueue<>();
+
+        @Override
+        public void onFlush(long segment, int position)
+        {
+            Iterator<WaitingFor> iter = waitingFor.iterator();

Review Comment:
   Can't this introduce blocking, where a waiting thread is stuck behind a 
later write? Probably we should drain and sort the queue. It would be nice also 
to use something better than a `ConcurrentLinkedQueue` (but not critical)
   



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to