File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -553,7 +553,13 @@ start:
553
553
p .promisesMu .Lock ()
554
554
for i , pr := range b .recs {
555
555
pr .LeaderEpoch = 0
556
- pr .Offset = b .baseOffset + int64 (i )
556
+ if b .baseOffset == - 1 {
557
+ // if the base offset is invalid/unknown (-1), all record offsets should
558
+ // be treated as unknown
559
+ pr .Offset = - 1
560
+ } else {
561
+ pr .Offset = b .baseOffset + int64 (i )
562
+ }
557
563
pr .Partition = b .partition
558
564
pr .ProducerID = b .pid
559
565
pr .ProducerEpoch = b .epoch
Original file line number Diff line number Diff line change @@ -1773,7 +1773,11 @@ func recordToRecord(
1773
1773
ProducerID : batch .ProducerID ,
1774
1774
ProducerEpoch : batch .ProducerEpoch ,
1775
1775
LeaderEpoch : batch .PartitionLeaderEpoch ,
1776
- Offset : batch .FirstOffset + int64 (record .OffsetDelta ),
1776
+ }
1777
+ if batch .FirstOffset == - 1 {
1778
+ r .Offset = - 1
1779
+ } else {
1780
+ r .Offset = batch .FirstOffset + int64 (record .OffsetDelta )
1777
1781
}
1778
1782
if r .Attrs .TimestampType () == 0 {
1779
1783
r .Timestamp = timeFromMillis (batch .FirstTimestamp + record .TimestampDelta64 )
You can’t perform that action at this time.
0 commit comments