hachikuji commented on a change in pull request #10480:
URL: https://github.com/apache/kafka/pull/10480#discussion_r620708379



##########
File path: raft/src/main/java/org/apache/kafka/raft/KafkaRaftClient.java
##########
@@ -1876,12 +1836,12 @@ private void appendBatch(
     }
 
     private long maybeAppendBatches(
-        LeaderState state,
+        LeaderState<T> state,
         long currentTimeMs
     ) {
-        long timeUnitFlush = accumulator.timeUntilDrain(currentTimeMs);
+        long timeUnitFlush = state.accumulator().timeUntilDrain(currentTimeMs);

Review comment:
       I was just interested in the spelling fix 😉 . I am fine with 
`timeUntilDrain` as well.

##########
File path: 
raft/src/main/java/org/apache/kafka/raft/internals/BatchAccumulator.java
##########
@@ -194,14 +196,50 @@ private void completeCurrentBatch() {
         MemoryRecords data = currentBatch.build();
         completed.add(new CompletedBatch<>(
             currentBatch.baseOffset(),
-            currentBatch.records(),
+            Optional.of(currentBatch.records()),
             data,
             memoryPool,
             currentBatch.initialBuffer()
         ));
         currentBatch = null;
     }
 
+    public void appendLeaderChangeMessage(LeaderChangeMessage 
leaderChangeMessage, long currentTimeMs) {
+        appendLock.lock();
+        try {
+            maybeCompleteDrain();
+            ByteBuffer buffer = memoryPool.tryAllocate(256);
+            if (buffer != null) {

Review comment:
       How about in the `else` case? Probably we need to raise an exception?




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

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


Reply via email to