You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "Kevin Wu (Jira)" <ji...@apache.org> on 2024/10/15 21:20:00 UTC

[jira] [Created] (KAFKA-17803) Reconcile Differences in MockLog and KafkaMetadataLog `read` Implementation

Kevin Wu created KAFKA-17803:
--------------------------------

             Summary: 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


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 MockLog to behave the same way as KafkaMetadataLog, since this would be safer than changing the semantics of the read call in UnifiedLog.

 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)