chia7712 commented on code in PR #18727: URL: https://github.com/apache/kafka/pull/18727#discussion_r1934092040
########## core/src/main/scala/kafka/server/KafkaApis.scala: ########## @@ -374,6 +374,11 @@ class KafkaApis(val requestChannel: RequestChannel, */ def handleProduceRequest(request: RequestChannel.Request, requestLocal: RequestLocal): Unit = { val produceRequest = request.body[ProduceRequest] + // See `ProduceRequest.MIN_VERSION` for details on why we need to do this + if (produceRequest.version < ProduceRequest.MIN_VERSION) { + requestHelper.sendErrorResponseMaybeThrottle(request, Errors.UNSUPPORTED_VERSION.exception()) + return; Review Comment: `;` is unnecessary ########## clients/src/main/java/org/apache/kafka/common/requests/ProduceRequest.java: ########## @@ -69,11 +74,6 @@ public ProduceRequest build(short version) { return build(version, true); } - // Visible for testing only - public ProduceRequest buildUnsafe(short version) { Review Comment: It seems we can merge `private ProduceRequest build(short version, boolean validate)` into `public ProduceRequest build(short version)`. Otherwise, IDE complains the method has a "always true" input variable `validate`. -- 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