kirktrue commented on code in PR #19489:
URL: https://github.com/apache/kafka/pull/19489#discussion_r2579223228
##########
clients/src/main/java/org/apache/kafka/clients/producer/internals/Sender.java:
##########
@@ -174,43 +174,6 @@ private void maybeRemoveAndDeallocateBatch(ProducerBatch
batch) {
this.accumulator.deallocate(batch);
}
- /**
- * Get the in-flight batches that has reached delivery timeout.
- */
- private List<ProducerBatch> getExpiredInflightBatches(long now) {
- List<ProducerBatch> expiredBatches = new ArrayList<>();
-
- for (Iterator<Map.Entry<TopicPartition, List<ProducerBatch>>> batchIt
= inFlightBatches.entrySet().iterator(); batchIt.hasNext();) {
- Map.Entry<TopicPartition, List<ProducerBatch>> entry =
batchIt.next();
- List<ProducerBatch> partitionInFlightBatches = entry.getValue();
- if (partitionInFlightBatches != null) {
- Iterator<ProducerBatch> iter =
partitionInFlightBatches.iterator();
- while (iter.hasNext()) {
- ProducerBatch batch = iter.next();
- if
(batch.hasReachedDeliveryTimeout(accumulator.getDeliveryTimeoutMs(), now)) {
- iter.remove();
- // expireBatches is called in Sender.sendProducerData,
before client.poll.
- // The !batch.isDone() invariant should always hold.
An IllegalStateException
- // exception will be thrown if the invariant is
violated.
- if (!batch.isDone()) {
- expiredBatches.add(batch);
- } else {
- throw new
IllegalStateException(batch.topicPartition + " batch created at " +
- batch.createdMs + " gets unexpected final
state " + batch.finalState());
- }
- } else {
- accumulator.maybeUpdateNextBatchExpiryTime(batch);
- break;
- }
- }
- if (partitionInFlightBatches.isEmpty()) {
- batchIt.remove();
- }
- }
- }
- return expiredBatches;
- }
-
Review Comment:
It would be good to get this running with the continuous integration to
ensure it doesn't cause problems elsewhere.
--
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]