kevin-wu24 opened a new pull request, #17528:
URL: https://github.com/apache/kafka/pull/17528

   Calling `MockLog` or `KafkaMetadataLog`'s read method for a given 
`startOffset` returns a `LogOffsetMetadata` object that contains an offset 
field. In the case of `MockLog`, this offset field is the base offset of the 
record batch which contains `startOffset`.
   
   However, in `KafkaMetadataLog`, this offset field is set to the given 
`startOffset`. If the given `startOffset` is in the middle of a batch, the 
returned `LogOffsetMetadata` will have an offset that does not match the file 
position of the returned batch. This makes the javadoc for `LogSegment#read` 
inaccurate since `startOffset` is not a lower bound when `startOffset` is not a 
batch's baseOffset (the base offset of the batch containing startOffset is the 
lower bound). 
   
   The discussed approach was to change `MockLog` to behave the same way as 
`KafkaMetadataLog`, since this would be safer than changing the semantics of 
the read call in `UnifiedLog`.
   
   Fixed some `MockLog` and `KafkaRaftClient` tests to account for this change 
in `MockLog`.
   
   ### 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