MahsaSeifikar commented on code in PR #19742: URL: https://github.com/apache/kafka/pull/19742#discussion_r2102685863
########## core/src/main/scala/kafka/server/ClientQuotaManager.scala: ########## @@ -428,18 +426,21 @@ 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 - + val quotaTypes = (userEntity.nonEmpty, clientEntity.nonEmpty) match { + case (true, true) => QuotaTypes.UserClientIdQuotaEnabled + case (true, false) => QuotaTypes.UserQuotaEnabled + case (false, true) => QuotaTypes.ClientIdQuotaEnabled + case (false, false) => QuotaTypes.NoQuotas Review Comment: My assumption here was incorrect. Having an empty `userEntity` and an empty `clientEntity `does not necessarily imply a no-op. It might also indicate that CustomQuotas are being used though. But I would expect this combination to be not expected in general. `quotaTypesEnabled` is defined [here](https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/server/ClientQuotaManager.scala#L160), so the base quota is not always `NoQuotas`. I'll update my PR to reflect this. -- 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