showuon commented on code in PR #15474:
URL: https://github.com/apache/kafka/pull/15474#discussion_r1519662867
##########
storage/src/main/java/org/apache/kafka/storage/internals/log/LogValidator.java:
##########
@@ -417,8 +422,14 @@ public ValidationResult
validateMessagesAndAssignOffsetsCompressed(LongRef offse
long lastOffset = offsetCounter.value - 1;
firstBatch.setLastOffset(lastOffset);
- if (timestampType == TimestampType.LOG_APPEND_TIME)
+ if (timestampType == TimestampType.LOG_APPEND_TIME) {
maxTimestamp = now;
+ if (toMagic >= RecordBatch.MAGIC_VALUE_V2) {
+ offsetOfMaxTimestamp = lastOffset;
Review Comment:
You're right, in the `create time` case, we'll scan through records 1 by 1,
and only set the `offsetOfMaxTimestamp` when timestamp > previous one, so the
semantic for MAX_TIMESTAMP is the _first offset_ with the max timestamp. Change
it to initialOffset for `append time` case.
--
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]