File tree 1 file changed +10
-0
lines changed
1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -438,13 +438,15 @@ def join_group
438
438
if old_generation_id && @group . generation_id != old_generation_id + 1
439
439
# We've been out of the group for at least an entire generation, no
440
440
# sense in trying to hold on to offset data
441
+ clear_current_offsets
441
442
@offset_manager . clear_offsets
442
443
else
443
444
# After rejoining the group we may have been assigned a new set of
444
445
# partitions. Keeping the old offset commits around forever would risk
445
446
# having the consumer go back and reprocess messages if it's assigned
446
447
# a partition it used to be assigned to way back. For that reason, we
447
448
# only keep commits for the partitions that we're still assigned.
449
+ clear_current_offsets ( excluding : @group . assigned_partitions )
448
450
@offset_manager . clear_offsets_excluding ( @group . assigned_partitions )
449
451
end
450
452
@@ -531,5 +533,13 @@ def fetch_batches
531
533
def pause_for ( topic , partition )
532
534
@pauses [ topic ] [ partition ]
533
535
end
536
+
537
+ def clear_current_offsets ( excluding : { } )
538
+ @current_offsets . each do |topic , partitions |
539
+ partitions . keep_if do |partition , _ |
540
+ excluding . fetch ( topic , [ ] ) . include? ( partition )
541
+ end
542
+ end
543
+ end
534
544
end
535
545
end
You can’t perform that action at this time.
0 commit comments