junrao commented on code in PR #19489:
URL: https://github.com/apache/kafka/pull/19489#discussion_r2625550884


##########
clients/src/test/java/org/apache/kafka/clients/producer/internals/SenderTest.java:
##########
@@ -2642,11 +2645,11 @@ public void testExpiredBatchDoesNotRetry() throws 
Exception {
     }
 
     @Test
-    public void testExpiredBatchDoesNotSplitOnMessageTooLargeError() throws 
Exception {
+    public void testBatchDoesNotSplitOnMessageTooLargeError() throws Exception 
{

Review Comment:
   The split batches are created automatically in Sender. You can probably just 
follow the following code in testTooLargeBatchesAreSafelyRemoved() to send 
extra produce responses after the split.
   
   ```
           // send request
           sender.runOnce();
           assertEquals(1, sender.inFlightBatches(tp0).size());
           // return a MESSAGE_TOO_LARGE error
           client.respond(produceResponse(tp0, -1, Errors.MESSAGE_TOO_LARGE, 
-1));
           sender.runOnce();
   
           // process retried response
           sender.runOnce();
           client.respond(produceResponse(tp0, 0, Errors.NONE, 0));
           sender.runOnce();
   
           // In-flight batches should be empty. Sleep past the expiration time 
of the batch and run once, no error should be thrown
           assertEquals(0, sender.inFlightBatches(tp0).size());
   
   ```



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