MahsaSeifikar commented on code in PR #19742: URL: https://github.com/apache/kafka/pull/19742#discussion_r2109889445
########## core/src/main/scala/kafka/server/ClientQuotaManager.scala: ########## @@ -155,6 +155,7 @@ class ClientQuotaManager(private val config: ClientQuotaManagerConfig, case None => new DefaultQuotaCallback } private val clientQuotaType = QuotaType.toClientQuotaType(quotaType) + private val activeQuotaEntities = new ConcurrentHashMap[ClientQuotaEntity, Boolean]() Review Comment: My assumption is that the number of unique keys, `KafkaQuotaEntity`, in the map is limited, so iterating through the map is not computationally expensive. > why doesn't it work to store the counts? Quotas can be added, updated, or deleted. Using the quota type as the key works for adding and deleting, but not for updating. For example, consider a controller mutation quota of 2 is set for `(userA, client1)`, and later it's updated to 5. In this case, increasing UserClient quota type would be incorrect. The main issue happened when the the customer wants to delete the quota; because it was counted twice, removing it would not work correctly. That’s why I use `KafkaQuotaEntity` as the key instead. -- 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