johnnychhsu opened a new pull request, #15476:
URL: https://github.com/apache/kafka/pull/15476

   ## Context
   Previously in the LogValidator, the `offsetOfMaxTimestamp` depends on two 
parameter check
   1. timestampType
   2. batch.toMagic
   If the `timestampType` is `LOG_APPEND_TIME`, and the `toMagic` is larger or 
equals to `MAGIC_VALUE_V2`, then we assign `offsetCounter.value - 1` to it, 
otherwise keep the initial value.
   
   However, in 
[KAFKA-14477](https://issues.apache.org/jira/browse/KAFKA-14477), this was 
changed, which modify `offsetOfMaxTimestamp` no matter whether it's 
`LOG_APPEND_TIME` or not, but only verify the `toMagic`, which led to this 
error.
   
   More details can be found in 
[KAFKA-16310](https://issues.apache.org/jira/browse/KAFKA-16310)
   
   ## Solution
   Fix the verifying logic and consider both the `timestampType` and magic 
version. 
   
   ## Test
   run `./gradlew clean core:test --tests 
integration.kafka.api.OffsetOfMaxTimestampTest.testWithNoCompression` and it 
passed
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   


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

Reply via email to