ezhou413 commented on code in PR #23483:
URL: https://github.com/apache/kafka/pull/23483#discussion_r4265610426


##########
clients/src/main/java/org/apache/kafka/clients/producer/internals/ChunkedByteBufferOutputStream.java:
##########
@@ -158,8 +171,20 @@ private void advanceWhileCurrentChunkFull() {
      */
     private void advanceToNextChunk() {
         if (currentChunkIndex + 1 >= chunks.size()) {
-            // TODO: KAFKA-20579. With compression support, grow here instead 
of throwing.
-            throw new IllegalStateException("write exceeded the stream's 
remaining chunk capacity");
+            // Non-blocking, and null rather than an exception when the pool 
has no memory right now or has been
+            // closed (the producer closes it before draining or aborting the 
last batches)
+            List<ByteBuffer> pooled = pool.tryAllocateChunks(chunkSize);

Review Comment:
   That sounds reasonable, will add. 



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

Reply via email to