ahuang98 commented on code in PR #19742:
URL: https://github.com/apache/kafka/pull/19742#discussion_r2107754429


##########
core/src/main/scala/kafka/server/ClientQuotaManager.scala:
##########
@@ -428,18 +427,19 @@ class ClientQuotaManager(private val config: 
ClientQuotaManagerConfig,
     try {
       val quotaEntity = KafkaQuotaEntity(userEntity, clientEntity)
 
-      if (userEntity.nonEmpty) {
-        if (quotaEntity.clientIdEntity.nonEmpty)
-          quotaTypesEnabled |= QuotaTypes.UserClientIdQuotaEnabled
-        else
-          quotaTypesEnabled |= QuotaTypes.UserQuotaEnabled
-      } else if (clientEntity.nonEmpty)
-        quotaTypesEnabled |= QuotaTypes.ClientIdQuotaEnabled
-
       quota match {
-        case Some(newQuota) => quotaCallback.updateQuota(clientQuotaType, 
quotaEntity, newQuota.bound)
-        case None => quotaCallback.removeQuota(clientQuotaType, quotaEntity)
+        case Some(newQuota) =>
+          quotaCallback.updateQuota(clientQuotaType, quotaEntity, 
newQuota.bound)
+          if(!activeQuotaEntities.put(quotaEntity, true)){

Review Comment:
   we're adding quotaEntity (of type KafkaQuotaEntity) to a map whose keys are 
of type ClientQuotaEntity?



##########
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:
   perhaps you meant to make the key type KafkaQuotaEntity - in any case 
though, I'm not sure I understand why the key is of type "...QuotaEntity" 
(which contains both the type and name) instead of just "ConfigEntityType" 
(which contains only the type)



-- 
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

Reply via email to