-
Notifications
You must be signed in to change notification settings - Fork 14.5k
KAFKA-18399 Remove ZooKeeper from KafkaApis (9/N): ALTER_CLIENT_QUOTAS and ALLOCATE_PRODUCER_IDS #18465
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KAFKA-18399 Remove ZooKeeper from KafkaApis (9/N): ALTER_CLIENT_QUOTAS and ALLOCATE_PRODUCER_IDS #18465
Changes from 4 commits
2b35ebb
a138372
e6b2977
9045434
cedebda
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2579,37 +2579,6 @@ class KafkaApis(val requestChannel: RequestChannel, | |
} | ||
} | ||
|
||
def handleAlterClientQuotasRequest(request: RequestChannel.Request): Unit = { | ||
val zkSupport = metadataSupport.requireZkOrThrow(KafkaApis.shouldAlwaysForward(request)) | ||
val alterClientQuotasRequest = request.body[AlterClientQuotasRequest] | ||
|
||
if (authHelper.authorize(request.context, ALTER_CONFIGS, CLUSTER, CLUSTER_NAME)) { | ||
val result = zkSupport.adminManager.alterClientQuotas(alterClientQuotasRequest.entries.asScala, | ||
alterClientQuotasRequest.validateOnly) | ||
|
||
val entriesData = result.iterator.map { case (quotaEntity, apiError) => | ||
val entityData = quotaEntity.entries.asScala.iterator.map { case (key, value) => | ||
new AlterClientQuotasResponseData.EntityData() | ||
.setEntityType(key) | ||
.setEntityName(value) | ||
}.toBuffer | ||
|
||
new AlterClientQuotasResponseData.EntryData() | ||
.setErrorCode(apiError.error.code) | ||
.setErrorMessage(apiError.message) | ||
.setEntity(entityData.asJava) | ||
}.toBuffer | ||
|
||
requestHelper.sendResponseMaybeThrottle(request, requestThrottleMs => | ||
new AlterClientQuotasResponse(new AlterClientQuotasResponseData() | ||
.setThrottleTimeMs(requestThrottleMs) | ||
.setEntries(entriesData.asJava))) | ||
} else { | ||
requestHelper.sendResponseMaybeThrottle(request, requestThrottleMs => | ||
alterClientQuotasRequest.getErrorResponse(requestThrottleMs, Errors.CLUSTER_AUTHORIZATION_FAILED.exception)) | ||
} | ||
} | ||
|
||
def handleDescribeUserScramCredentialsRequest(request: RequestChannel.Request): Unit = { | ||
val describeUserScramCredentialsRequest = request.body[DescribeUserScramCredentialsRequest] | ||
|
||
|
@@ -2813,19 +2782,7 @@ class KafkaApis(val requestChannel: RequestChannel, | |
} | ||
|
||
def handleAllocateProducerIdsRequest(request: RequestChannel.Request): Unit = { | ||
val zkSupport = metadataSupport.requireZkOrThrow(KafkaApis.shouldNeverReceive(request)) | ||
authHelper.authorizeClusterOperation(request, CLUSTER_ACTION) | ||
|
||
val allocateProducerIdsRequest = request.body[AllocateProducerIdsRequest] | ||
|
||
if (!zkSupport.controller.isActive) | ||
requestHelper.sendResponseMaybeThrottle(request, throttleTimeMs => | ||
allocateProducerIdsRequest.getErrorResponse(throttleTimeMs, Errors.NOT_CONTROLLER.exception)) | ||
else | ||
zkSupport.controller.allocateProducerIds(allocateProducerIdsRequest.data, producerIdsResponse => | ||
requestHelper.sendResponseMaybeThrottle(request, throttleTimeMs => | ||
new AllocateProducerIdsResponse(producerIdsResponse.setThrottleTimeMs(throttleTimeMs))) | ||
) | ||
throw KafkaApis.shouldNeverReceive(request) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we shouldn't handle it like this - this is one of the request types that is only handled by the controller listener (now that zk is gone):
So, we should have generic logic that handles that automatically before it gets here. We can probably just delete this whole method. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
totally agree that we should have a generic logic for those zk-related handler. The socket server can reject the zk-related requests automatically, and we can rewrite In short, the line There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, exactly. We can also remove the zk listener from the json files and the socket server will automatically do the right thing, I believe (i.e. it already has logic for that). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} | ||
|
||
private def groupVersion(): GroupVersion = { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove this handle also