@@ -50,6 +50,7 @@ import org.apache.kafka.image.{LocalReplicaChanges, MetadataImage, TopicsDelta}
5050import org .apache .kafka .logger .StateChangeLogger
5151import org .apache .kafka .metadata .LeaderConstants .NO_LEADER
5252import org .apache .kafka .metadata .MetadataCache
53+ import org .apache .kafka .server .LogAppendResult .LogAppendSummary
5354import org .apache .kafka .server .common .{DirectoryEventHandler , RequestLocal , StopPartition , TransactionVersion }
5455import org .apache .kafka .server .log .remote .TopicPartitionLog
5556import org .apache .kafka .server .config .ReplicationConfigs
@@ -687,7 +688,7 @@ class ReplicaManager(val config: KafkaConfig,
687688 val produceStatus = buildProducePartitionStatus(localProduceResults)
688689
689690 recordValidationStatsCallback(localProduceResults.map { case (k, v) =>
690- k -> v.info .recordValidationStats
691+ k -> v.logAppendSummary() .recordValidationStats()
691692 })
692693
693694 maybeAddDelayedProduce(
@@ -770,7 +771,7 @@ class ReplicaManager(val config: KafkaConfig,
770771 case _ => None
771772 }
772773 new TopicIdPartition (topicIds.getOrElse(topicPartition.topic(), Uuid .ZERO_UUID ), topicPartition) -> new LogAppendResult (
773- LogAppendInfo .UNKNOWN_LOG_APPEND_INFO ,
774+ LogAppendSummary .fromAppendInfo( LogAppendInfo .UNKNOWN_LOG_APPEND_INFO ) ,
774775 Optional .of(customException.getOrElse(error.exception)),
775776 customException.isDefined
776777 )
@@ -860,13 +861,13 @@ class ReplicaManager(val config: KafkaConfig,
860861 ): Map [TopicIdPartition , ProducePartitionStatus ] = {
861862 results.map { case (topicIdPartition, result) =>
862863 topicIdPartition -> ProducePartitionStatus (
863- result.info .lastOffset + 1 , // required offset
864+ result.logAppendSummary .lastOffset + 1 , // required offset
864865 new PartitionResponse (
865866 result.error,
866- result.info .firstOffset,
867- result.info .logAppendTime,
868- result.info .logStartOffset,
869- result.info .recordErrors,
867+ result.logAppendSummary .firstOffset,
868+ result.logAppendSummary .logAppendTime,
869+ result.logAppendSummary .logStartOffset,
870+ result.logAppendSummary .recordErrors,
870871 result.errorMessage
871872 )
872873 )
@@ -880,7 +881,7 @@ class ReplicaManager(val config: KafkaConfig,
880881 actionQueue.add {
881882 () => appendResults.foreach { case (topicIdPartition, result) =>
882883 val requestKey = new TopicPartitionOperationKey (topicIdPartition.topicPartition)
883- result.info .leaderHwChange match {
884+ result.logAppendSummary .leaderHwChange match {
884885 case LeaderHwChange .INCREASED =>
885886 // some delayed operations may be unblocked after HW changed
886887 delayedProducePurgatory.checkAndComplete(requestKey)
@@ -1403,7 +1404,7 @@ class ReplicaManager(val config: KafkaConfig,
14031404 // reject appending to internal topics if it is not allowed
14041405 if (Topic .isInternal(topicIdPartition.topic) && ! internalTopicsAllowed) {
14051406 (topicIdPartition, new LogAppendResult (
1406- LogAppendInfo .UNKNOWN_LOG_APPEND_INFO ,
1407+ LogAppendSummary .fromAppendInfo( LogAppendInfo .UNKNOWN_LOG_APPEND_INFO ) ,
14071408 Optional .of(new InvalidTopicException (s " Cannot append to internal topic ${topicIdPartition.topic}" )),
14081409 false ))
14091410 } else {
@@ -1423,7 +1424,7 @@ class ReplicaManager(val config: KafkaConfig,
14231424 trace(s " ${records.sizeInBytes} written to log $topicIdPartition beginning at offset " +
14241425 s " ${info.firstOffset} and ending at offset ${info.lastOffset}" )
14251426
1426- (topicIdPartition, new LogAppendResult (info, Optional .empty(), false ))
1427+ (topicIdPartition, new LogAppendResult (LogAppendSummary .fromAppendInfo( info) , Optional .empty(), false ))
14271428
14281429 } catch {
14291430 // NOTE: Failed produce requests metric is not incremented for known exceptions
@@ -1435,15 +1436,18 @@ class ReplicaManager(val config: KafkaConfig,
14351436 _ : CorruptRecordException |
14361437 _ : KafkaStorageException |
14371438 _ : UnknownTopicIdException ) =>
1438- (topicIdPartition, new LogAppendResult (LogAppendInfo .UNKNOWN_LOG_APPEND_INFO , Optional .of(e), false ))
1439+ (topicIdPartition, new LogAppendResult (LogAppendSummary .fromAppendInfo(LogAppendInfo .UNKNOWN_LOG_APPEND_INFO ),
1440+ Optional .of(e), false ))
14391441 case rve : RecordValidationException =>
14401442 val logStartOffset = processFailedRecord(topicIdPartition, rve.invalidException)
14411443 val recordErrors = rve.recordErrors
1442- (topicIdPartition, new LogAppendResult (LogAppendInfo .unknownLogAppendInfoWithAdditionalInfo(logStartOffset, recordErrors),
1444+ (topicIdPartition, new LogAppendResult (
1445+ LogAppendSummary .fromAppendInfo(LogAppendInfo .unknownLogAppendInfoWithAdditionalInfo(logStartOffset, recordErrors)),
14431446 Optional .of(rve.invalidException), true ))
14441447 case t : Throwable =>
14451448 val logStartOffset = processFailedRecord(topicIdPartition, t)
1446- (topicIdPartition, new LogAppendResult (LogAppendInfo .unknownLogAppendInfoWithLogStartOffset(logStartOffset),
1449+ (topicIdPartition, new LogAppendResult (
1450+ LogAppendSummary .fromAppendInfo(LogAppendInfo .unknownLogAppendInfoWithLogStartOffset(logStartOffset)),
14471451 Optional .of(t), false ))
14481452 }
14491453 }
0 commit comments