jolshan commented on code in PR #14378:
URL: https://github.com/apache/kafka/pull/14378#discussion_r1324696082
##########
core/src/main/scala/kafka/server/ReplicaManager.scala:
##########
@@ -753,39 +753,63 @@ class ReplicaManager(val config: KafkaConfig,
val localProduceResults = appendToLocalLog(internalTopicsAllowed =
internalTopicsAllowed,
origin, verifiedEntries, requiredAcks, requestLocal,
verificationGuards.toMap)
debug("Produce to local log in %d ms".format(time.milliseconds -
sTime))
-
- val unverifiedResults = unverifiedEntries.map { case (topicPartition,
error) =>
- val message = if (error == Errors.INVALID_TXN_STATE) "Partition was
not added to the transaction" else error.message()
- topicPartition -> LogAppendResult(
- LogAppendInfo.UNKNOWN_LOG_APPEND_INFO,
- Some(error.exception(message))
- )
- }
- val errorResults = errorsPerPartition.map { case (topicPartition,
error) =>
- topicPartition -> LogAppendResult(
- LogAppendInfo.UNKNOWN_LOG_APPEND_INFO,
- Some(error.exception())
- )
+ def produceStatusResult(appendResult: Map[TopicPartition,
LogAppendResult],
+ useCustomMessage: Boolean):
Map[TopicPartition, ProducePartitionStatus] = {
+ appendResult.map { case (topicPartition, result) =>
+ topicPartition -> ProducePartitionStatus(
+ result.info.lastOffset + 1, // required offset
+ new PartitionResponse(
+ result.error,
+ result.info.firstOffset.map[Long](_.messageOffset).orElse(-1L),
+ result.info.lastOffset,
+ result.info.logAppendTime,
+ result.info.logStartOffset,
+ result.info.recordErrors,
+ if (useCustomMessage) result.exception.get.getMessage else
result.info.errorMessage
Review Comment:
I'm not sure I understand. Previously the result.info.errorMessage was null
and it will continue to be so for all error partitions.
LogAppendInfo.UnknownLogAppendInfo will always have a null error.
I thought for consistency I should not change this.
--
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]