kevin-wu24 commented on code in PR #23525:
URL: https://github.com/apache/kafka/pull/23525#discussion_r4063854722


##########
metadata/src/main/java/org/apache/kafka/controller/QuorumController.java:
##########
@@ -915,22 +915,18 @@ static long appendRecords(
                 // The appender callback will create an in-memory snapshot for 
each batch,
                 // since we might need to revert to any of them. We will only 
return the final
                 // offset of the last batch, however.
-                int startIndex = 0, numBatches = 0;
-                while (true) {
+                int numBatches = 0;
+                long lastOffset = -1;
+                for (int startIndex = 0; startIndex < records.size(); 
startIndex += maxRecordsPerBatch) {
                     numBatches++;
-                    int endIndex = startIndex + maxRecordsPerBatch;
-                    if (endIndex > records.size()) {

Review Comment:
   What about making this check instead:
   `if (endIndex >= records.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