hachikuji commented on code in PR #13231: URL: https://github.com/apache/kafka/pull/13231#discussion_r1107759467
########## clients/src/main/java/org/apache/kafka/common/requests/AddPartitionsToTxnRequest.java: ########## @@ -66,24 +97,22 @@ public Builder(final String transactionalId, AddPartitionsToTxnTopicCollection topics = new AddPartitionsToTxnTopicCollection(); for (Map.Entry<String, List<Integer>> partitionEntry : partitionMap.entrySet()) { topics.add(new AddPartitionsToTxnTopic() - .setName(partitionEntry.getKey()) - .setPartitions(partitionEntry.getValue())); + .setName(partitionEntry.getKey()) + .setPartitions(partitionEntry.getValue())); } - - this.data = new AddPartitionsToTxnRequestData() - .setTransactionalId(transactionalId) - .setProducerId(producerId) - .setProducerEpoch(producerEpoch) - .setTopics(topics); + return topics; } @Override public AddPartitionsToTxnRequest build(short version) { - return new AddPartitionsToTxnRequest(data, version); + short clampedVersion = (isClientRequest && version > 3) ? 3 : version; Review Comment: It comes from `AbstractRequest.Builder`. You can pass the min and max versions in the constructor. -- 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