hachikuji commented on a change in pull request #10480: URL: https://github.com/apache/kafka/pull/10480#discussion_r622378516
########## File path: raft/src/main/java/org/apache/kafka/raft/KafkaRaftClient.java ########## @@ -1859,15 +1819,14 @@ private void appendBatch( offsetAndEpoch.offset + 1, Integer.MAX_VALUE); future.whenComplete((commitTimeMs, exception) -> { - int numRecords = batch.records.size(); if (exception != null) { - logger.debug("Failed to commit {} records at {}", numRecords, offsetAndEpoch, exception); + logger.debug("Failed to commit {} records at {}", batch.numRecords, offsetAndEpoch, exception); } else { long elapsedTime = Math.max(0, commitTimeMs - appendTimeMs); - double elapsedTimePerRecord = (double) elapsedTime / numRecords; + double elapsedTimePerRecord = (double) elapsedTime / batch.numRecords; kafkaRaftMetrics.updateCommitLatency(elapsedTimePerRecord, appendTimeMs); - logger.debug("Completed commit of {} records at {}", numRecords, offsetAndEpoch); - maybeFireHandleCommit(batch.baseOffset, epoch, batch.records); + logger.debug("Completed commit of {} records at {}", batch.numRecords, offsetAndEpoch); + maybeFireHandleCommit(batch.baseOffset, epoch, batch.records.get()); Review comment: We still need to protect the call to `get()` here, right? ```java batch.records.ifPresent(records -> maybeFireHandleCommit(batch.baseOffset, epoch, records)); ``` -- 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