mimaison commented on code in PR #13038:
URL: https://github.com/apache/kafka/pull/13038#discussion_r1057616357


##########
core/src/main/scala/kafka/log/UnifiedLog.scala:
##########
@@ -939,14 +938,14 @@ class UnifiedLog(@volatile var logStartOffset: Long,
 
           maybeDuplicate match {
             case Some(duplicate) =>
-              appendInfo.firstOffset = 
Some(LogOffsetMetadata(duplicate.firstOffset))
+              appendInfo.firstOffset = Some(new 
LogOffsetMetadata(duplicate.firstOffset))
               appendInfo.lastOffset = duplicate.lastOffset
               appendInfo.logAppendTime = duplicate.timestamp
               appendInfo.logStartOffset = logStartOffset
             case None =>
               // Before appending update the first offset metadata to include 
segment information
               appendInfo.firstOffset = appendInfo.firstOffset.map { 
offsetMetadata =>
-                offsetMetadata.copy(segmentBaseOffset = segment.baseOffset, 
relativePositionInSegment = segment.size)
+                new LogOffsetMetadata(offsetMetadata.messageOffset(), 
segment.baseOffset, segment.size)

Review Comment:
   It's the only place where we do this. Apart if you have a strong opinion on 
this, I find using the constructor here fine.



-- 
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

Reply via email to