splett2 commented on code in PR #15454:
URL: https://github.com/apache/kafka/pull/15454#discussion_r1511954682
##########
core/src/main/scala/kafka/server/AddPartitionsToTxnManager.scala:
##########
@@ -80,10 +81,9 @@ class AddPartitionsToTxnManager(
topicPartitions: Seq[TopicPartition],
callback: AddPartitionsToTxnManager.AppendCallback
): Unit = {
- val (error, node) =
getTransactionCoordinator(partitionFor(transactionalId))
-
- if (error != Errors.NONE) {
- callback(topicPartitions.map(tp => tp -> error).toMap)
+ val coordinatorNode =
getTransactionCoordinator(partitionFor(transactionalId))
+ if (coordinatorNode.isEmpty) {
+ callback(topicPartitions.map(tp => tp ->
Errors.COORDINATOR_NOT_AVAILABLE).toMap)
Review Comment:
we only returned either of (COORDINATOR_NOT_AVAILABLE, NoNode) or (NONE,
SomeNode). Returning an option and translating to the appropriate error in the
caller seemed simpler.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]