You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "dengziming (via GitHub)" <gi...@apache.org> on 2023/06/09 06:58:57 UTC
[GitHub] [kafka] dengziming commented on a diff in pull request #13826: KAFKA-15060: fix the ApiVersionManager interface
dengziming commented on code in PR #13826:
URL: https://github.com/apache/kafka/pull/13826#discussion_r1223802381
##########
core/src/main/scala/kafka/server/metadata/ZkMetadataCache.scala:
##########
@@ -584,4 +584,12 @@ class ZkMetadataCache(
def getFeatureOption: Option[FinalizedFeaturesAndEpoch] = {
featuresAndEpoch
}
+
+ override def versionContext(): MetadataVersionContext = {
Review Comment:
The name is confusing, we include features and metadata version in the context, it's better to use FeaturesContext since metadata version is also a feature.
##########
core/src/main/scala/kafka/server/ControllerApis.scala:
##########
@@ -447,16 +447,9 @@ class ControllerApis(val requestChannel: RequestChannel,
requestThrottleMs => apiVersionRequest.getErrorResponse(requestThrottleMs, INVALID_REQUEST.exception))
CompletableFuture.completedFuture[Unit](())
} else {
- val context = new ControllerRequestContext(request.context.header.data, request.context.principal, OptionalLong.empty())
- controller.finalizedFeatures(context).handle { (result, exception) =>
- requestHelper.sendResponseMaybeThrottle(request, requestThrottleMs => {
- if (exception != null) {
- apiVersionRequest.getErrorResponse(requestThrottleMs, exception)
- } else {
- apiVersionManager.apiVersionResponse(requestThrottleMs, result.featureMap().asScala.toMap, result.epoch())
- }
- })
- }
+ requestHelper.sendResponseMaybeThrottle(request,
Review Comment:
Since we are changing back to the original code, we can make it the same as KafkaApis, like this:
```
def createResponseCallback(requestThrottleMs: Int): ApiVersionsResponse = {
val apiVersionRequest = request.body[ApiVersionsRequest]
if (apiVersionRequest.hasUnsupportedRequestVersion) {
apiVersionRequest.getErrorResponse(requestThrottleMs, Errors.UNSUPPORTED_VERSION.exception)
} else if (!apiVersionRequest.isValid) {
apiVersionRequest.getErrorResponse(requestThrottleMs, Errors.INVALID_REQUEST.exception)
} else {
apiVersionManager.apiVersionResponse(requestThrottleMs)
}
}
requestHelper.sendResponseMaybeThrottle(request, createResponseCallback)
```
--
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-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org