ruanliang-hualun commented on code in PR #12066: URL: https://github.com/apache/kafka/pull/12066#discussion_r852691675
########## clients/src/main/java/org/apache/kafka/clients/producer/internals/RecordAccumulator.java: ########## @@ -560,12 +561,14 @@ private List<ProducerBatch> drainBatchesForOneNode(Cluster cluster, Node node, i List<PartitionInfo> parts = cluster.partitionsForNode(node.id()); List<ProducerBatch> ready = new ArrayList<>(); /* to make starvation less likely this loop doesn't start at 0 */ + int drainIndex = getDrainIndex(node.idString()); int start = drainIndex = drainIndex % parts.size(); + updateDrainIndex(node.idString(),drainIndex); do { PartitionInfo part = parts.get(drainIndex); TopicPartition tp = new TopicPartition(part.topic(), part.partition()); - this.drainIndex = (this.drainIndex + 1) % parts.size(); - + drainIndex = (drainIndex + 1) % parts.size(); + updateDrainIndex(node.idString(),drainIndex); Review Comment: thanks for the advice , i will modify and resubmit -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org