[
https://issues.apache.org/jira/browse/KAFKA-17803?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jun Rao resolved KAFKA-17803.
-----------------------------
Fix Version/s: 4.0.0
Resolution: Fixed
merged the PR to trunk
> Reconcile Differences in MockLog and KafkaMetadataLog `read` Implementation
> ---------------------------------------------------------------------------
>
> Key: KAFKA-17803
> URL: https://issues.apache.org/jira/browse/KAFKA-17803
> Project: Kafka
> Issue Type: Improvement
> Reporter: Kevin Wu
> Assignee: Kevin Wu
> Priority: Major
> Fix For: 4.0.0
>
>
> 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 in this case since startOffset is not a lower bound (the base
> offset of the batch containing startOffset is the lower bound).
> The discussed approach was to change the UnifiedLog and LogSegment
> implementation to return the offset at the start of the batch since that is
> the offset that is located at the byte start position of the batch. This way
> KafkaMetadataLog#read semantics match MockLog#read.
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)