You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "ijuma (via GitHub)" <gi...@apache.org> on 2023/02/12 18:09:18 UTC

[GitHub] [kafka] ijuma commented on a diff in pull request #13078: KAFKA-13999: Add ProducerCount metrics (KIP-847)

ijuma commented on code in PR #13078:
URL: https://github.com/apache/kafka/pull/13078#discussion_r1103849776


##########
core/src/main/scala/kafka/log/ProducerStateManager.scala:
##########
@@ -504,7 +520,7 @@ class ProducerStateManager(
    * Truncate the producer id mapping and remove all snapshots. This resets the state of the mapping.
    */
   def truncateFullyAndStartAt(offset: Long): Unit = {
-    producers.clear()
+    removeProducerIds(producers.keySet)

Review Comment:
   It's much cheaper to clear a map than to remove all the keys. It probably makes sense to have a `clearProducerIds` method as well.



-- 
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-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org