guozhangwang commented on a change in pull request #11098: URL: https://github.com/apache/kafka/pull/11098#discussion_r677680568
########## File path: core/src/main/scala/kafka/coordinator/transaction/TransactionStateManager.scala ########## @@ -161,22 +162,26 @@ class TransactionStateManager(brokerId: Int, maxBatchSize ) - partitionCacheEntry.metadataPerTransactionalId.foreachWhile { (transactionalId, txnMetadata) => + var breakIteration = false Review comment: In that case, I feel it may actually get cleaner to inline `collectExpiredTransactionalIds` into the caller, and hence to get just one while loop / flag, we can still distinguish the case where the log is offline and hence we should not proceed v.s. the batch is full, we should write once and proceed. WDYT? -- 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