MahsaSeifikar commented on code in PR #19742:
URL: https://github.com/apache/kafka/pull/19742#discussion_r2107840373
##########
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:
`KafkaQuotaEntity` is used as the key for `activeQuotaEntities` because it
tracks entity name (e.g., "userA" or "client1", or default user or client) and
we can extract the entity type from that. Consider a scenario where a customer
has two quotas: one for `(userA, client1)` and another for `(userA, client2)`.
If we only tracked the entity type, removing the quota for one combination
(e.g., `(userA, client1)`) could incorrectly affect other combinations of the
same type (e.g., `(userA, client2)`). By using `KafkaQuotaEntity`, we make sure
that removing one quota does not impact others of the same type. I found this
issue while testing scenarios involving duplicate quota types.
--
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]