Commit c434993
Fix actual seek-on-empty-poll wedge in KafkaPartitionLevelConsumer
Spotted a bug in my own previous attempt while staring at the unchanged CI
failure: setting _lastFetchedOffset = startOffset - 1 in the empty-poll
branch does not skip the re-seek when startOffset == 0 (= -1, which still
trips the _lastFetchedOffset < 0 clause of the seek-check). That clause
was the original intent's "have we ever fetched" sentinel and a sentinel
value of -1 is indistinguishable from "we haven't fetched yet" and "we
fetched at offset 0".
Replace with an explicit _lastSeekedStartOffset (Long.MIN_VALUE initially)
that tracks whether we've already issued a seek for the caller's
startOffset. The seek-check is now:
firstSeekForThisOffset = _lastSeekedStartOffset != startOffset
if (firstSeekForThisOffset || _lastFetchedOffset != startOffset - 1)
The first time the caller asks for startOffset = N, we seek and record N.
On subsequent calls with the same startOffset we do NOT re-seek, so the
consumer's internal fetch session can advance through aborted records on
later polls instead of being reset to startOffset every time.
This is the part that the previous fix missed -- _lastFetchedOffset = -1
+ the existing < 0 check kept re-seeking even after we marked the offset.
Mirrored to both pinot-kafka-3.0 and pinot-kafka-4.0.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 27d4c4b commit c434993
2 files changed
Lines changed: 34 additions & 7 deletions
File tree
- pinot-plugins/pinot-stream-ingestion
- pinot-kafka-3.0/src/main/java/org/apache/pinot/plugin/stream/kafka30
- pinot-kafka-4.0/src/main/java/org/apache/pinot/plugin/stream/kafka40
Lines changed: 17 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
51 | | - | |
52 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
53 | 58 | | |
54 | 59 | | |
55 | 60 | | |
| |||
67 | 72 | | |
68 | 73 | | |
69 | 74 | | |
70 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
71 | 83 | | |
72 | 84 | | |
73 | 85 | | |
74 | 86 | | |
| 87 | + | |
75 | 88 | | |
76 | 89 | | |
77 | 90 | | |
| |||
Lines changed: 17 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
51 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
52 | 58 | | |
53 | 59 | | |
54 | 60 | | |
| |||
66 | 72 | | |
67 | 73 | | |
68 | 74 | | |
69 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
70 | 83 | | |
71 | 84 | | |
72 | 85 | | |
73 | 86 | | |
| 87 | + | |
74 | 88 | | |
75 | 89 | | |
76 | 90 | | |
| |||
0 commit comments