Jun Rao created KAFKA-12153:
-------------------------------
Summary: follower can hit OffsetOutOfRangeException during
truncation
Key: KAFKA-12153
URL: https://issues.apache.org/jira/browse/KAFKA-12153
Project: Kafka
Issue Type: Bug
Components: core
Affects Versions: 2.7.0
Reporter: Jun Rao
Assignee: Jason Gustafson
Currently, we have the following code path.
log.truncateTo() => updateLogEndOffset() => updateHighWatermarkMetadata() =>
maybeIncrementFirstUnstableOffset() => convertToOffsetMetadataOrThrow() =>
read()
This path seems problematic. The issue is that updateLogEndOffset() is called
before loadProducerState() in log.truncateTo(). At that point, the
producerState is not reflecting the truncated state yet and
producerStateManager.firstUnstableOffset(called in
maybeIncrementFirstUnstableOffset() to feed read()) could return an offset
larger than the truncated logEndOffset, which will lead to
OffsetOutOfRangeException.
This issue is relatively rare since it requires truncation below the high
watermark.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)