Shantanu Kawale created KAFKA-21425:
---------------------------------------

             Summary: **MAX\_TIMESTAMP can return an offset below the log start 
offset**
                 Key: KAFKA-21425
                 URL: https://issues.apache.org/jira/browse/KAFKA-21425
             Project: Kafka
          Issue Type: Bug
            Reporter: Shantanu Kawale
            Assignee: Shantanu Kawale


After DeleteRecords advances the log start offset into a segment,
a MAX_TIMESTAMP lookup can return a logically deleted record because
the segment's cached maximum timestamp still includes that record.

Reproduction:
1. Append three records in one batch:
   offset 0: timestamp T+100
   offset 1: timestamp T+20
   offset 2: timestamp T+5
2. Advance the high watermark to the log end.
3. Use DeleteRecords to advance the log start offset to 1.
4. Query ListOffsets using MAX_TIMESTAMP.

Expected: timestamp T+20 at offset 1.
Actual: timestamp T+100 at offset 0, below the log start offset.

Proposed fix:
Exclude records below the log start offset when finding the maximum
timestamp, while preserving the cached lookup where applicable.

Patch: https://github.com/apache/kafka/pull/24027

Related issues:
KAFKA-21317: Resolved by PR #24028 for ordinary timestamp searches.
KAFKA-21204: Separately covers the fetchable upper offset bound.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to