Description
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.
Attachments
Issue Links
- links to