divijvaidya commented on code in PR #12106: URL: https://github.com/apache/kafka/pull/12106#discussion_r862747446
########## core/src/main/scala/kafka/server/ControllerApis.scala: ########## @@ -767,7 +767,7 @@ class ControllerApis(val requestChannel: RequestChannel, setErrorCode(TOPIC_AUTHORIZATION_FAILED.code)) } } - controller.createPartitions(context, topics).thenApply { results => + controller.createPartitions(context, topics, request.validateOnly()).thenApply { results => Review Comment: nit you don't need the parenthesis in scala here. Simply `request.validateOnly` would work. ########## metadata/src/main/java/org/apache/kafka/controller/QuorumController.java: ########## @@ -1664,13 +1664,14 @@ public CompletableFuture<UpdateFeaturesResponseData> updateFeatures( @Override public CompletableFuture<List<CreatePartitionsTopicResult>> createPartitions( Review Comment: You can handle the `validateOnly` here and downstream function calls do not have to know about it. This would greatly simplify the code because now `ReplicationControl` does not have to deal with parsing the result and handling the `validateOnly` flag e.g. this function implementation would change to ``` if (topics.isEmpty()) { return CompletableFuture.completedFuture(Collections.emptyList()); } return appendWriteEvent("createPartitions", context.deadlineNs(), () -> { final ControllerResult<List<CreatePartitionsTopicResult>> result = replicationControl.createPartitions(topics); return validateOnly ? result.withoutRecords() : result; }); ``` -- 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