junrao commented on code in PR #15476: URL: https://github.com/apache/kafka/pull/15476#discussion_r1518413083
########## storage/src/main/java/org/apache/kafka/storage/internals/log/LogValidator.java: ########## @@ -293,11 +293,11 @@ public ValidationResult assignOffsetsNonCompressed(LongRef offsetCounter, if (timestampType == TimestampType.LOG_APPEND_TIME) { maxTimestamp = now; - offsetOfMaxTimestamp = initialOffset; - } - - if (toMagic >= RecordBatch.MAGIC_VALUE_V2) { - offsetOfMaxTimestamp = offsetCounter.value - 1; + if (toMagic >= RecordBatch.MAGIC_VALUE_V2) { + offsetOfMaxTimestamp = offsetCounter.value - 1; + } else { + offsetOfMaxTimestamp = initialOffset; Review Comment: We pass `offsetOfMaxTimestamp` to `ValidationResult.shallowOffsetOfMaxTimestampMs`. Using shallow offset used to be ok. But when we added the `MAX_TIMESTAMP` support for ListOffset, it becomes important for offsetOfMaxTimestamp to be at the exact record level, instead of the shallow batch level. So, we need to rename `ValidationResult.shallowOffsetOfMaxTimestampMs` properly to make it clear. Also, there are other places like `LogSegment.append()` where we use the name `shallowOffsetOfMaxTimestamp`. We will need to rename it too to be clear. -- 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