iamaleksey commented on code in PR #2982:
URL: https://github.com/apache/cassandra/pull/2982#discussion_r1450642275
##########
src/java/org/apache/cassandra/service/accord/AccordJournal.java:
##########
@@ -699,6 +1003,246 @@ private static int msVersion(int version)
}
}
+ /*
+ * Record framing logic
+ */
+
+ private final class FrameAggregator implements Interruptible.Task
+ {
+ /* external MPSC pending request queue */
+ private final ManyToOneConcurrentLinkedQueue<PendingRequest>
unframedRequests = new ManyToOneConcurrentLinkedQueue<>();
+
+ private final LongArrayList waitForEpochs = new LongArrayList();
+ private final Long2ObjectHashMap<ArrayList<PendingRequest>>
delayedRequests = new Long2ObjectHashMap<>();
+
+ private volatile Interruptible executor;
+
+ // a signal and flag that callers outside the aggregator thread can use
+ // to signal they want the aggregator to run again
+ private final Semaphore haveWork = newSemaphore(1);
+
+ void onWrite(Pointer pointer, RequestContext context)
+ {
+ unframedRequests.add(new PendingRequest(pointer, context));
Review Comment:
Good call. Implemented without going too hard.
--
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]