ijuma commented on code in PR #18483:
URL: https://github.com/apache/kafka/pull/18483#discussion_r1917618930
##########
core/src/main/scala/kafka/server/KafkaApis.scala:
##########
@@ -2368,39 +2368,11 @@ class KafkaApis(val requestChannel: RequestChannel,
requestHelper.sendResponseMaybeThrottle(request, requestThrottleMs =>
describeClientQuotasRequest.getErrorResponse(requestThrottleMs,
Errors.CLUSTER_AUTHORIZATION_FAILED.exception))
} else {
- metadataSupport match {
- case ZkSupport(adminManager, controller, zkClient, forwardingManager,
metadataCache, _) =>
- val result =
adminManager.describeClientQuotas(describeClientQuotasRequest.filter)
-
- val entriesData = result.iterator.map { case (quotaEntity,
quotaValues) =>
- val entityData = quotaEntity.entries.asScala.iterator.map { case
(entityType, entityName) =>
- new DescribeClientQuotasResponseData.EntityData()
- .setEntityType(entityType)
- .setEntityName(entityName)
- }.toBuffer
-
- val valueData = quotaValues.iterator.map { case (key, value) =>
- new DescribeClientQuotasResponseData.ValueData()
- .setKey(key)
- .setValue(value)
- }.toBuffer
-
- new DescribeClientQuotasResponseData.EntryData()
- .setEntity(entityData.asJava)
- .setValues(valueData.asJava)
- }.toBuffer
-
- requestHelper.sendResponseMaybeThrottle(request, requestThrottleMs =>
- new DescribeClientQuotasResponse(new
DescribeClientQuotasResponseData()
- .setThrottleTimeMs(requestThrottleMs)
- .setEntries(entriesData.asJava)))
- case RaftSupport(_, metadataCache) =>
- val result =
metadataCache.describeClientQuotas(describeClientQuotasRequest.data())
- requestHelper.sendResponseMaybeThrottle(request, requestThrottleMs
=> {
- result.setThrottleTimeMs(requestThrottleMs)
- new DescribeClientQuotasResponse(result)
- })
- }
+ val result =
metadataCache.asInstanceOf[KRaftMetadataCache].describeClientQuotas(describeClientQuotasRequest.data())
Review Comment:
A note for someone who sees this - there is a plan to address these casts
separately. My suggestion elsewhere is to simply move the relevant methods to
the base interface and then the cast is no longer needed.
--
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]