@@ -74,30 +74,29 @@ func (l *partitionLifecycler) Assign(ctx context.Context, _ *kgo.Client, topics
7474}
7575
7676// Revoke implements kgo.OnPartitionsRevoked.
77- func (l * partitionLifecycler ) Revoke (_ context.Context , _ * kgo.Client , topics map [string ][]int32 ) {
77+ func (l * partitionLifecycler ) Revoke (ctx context.Context , client * kgo.Client , topics map [string ][]int32 ) {
78+ l .revoke (ctx , client , topics )
79+ }
80+
81+ // Lost implements kgo.OnPartitionsLost.
82+ func (l * partitionLifecycler ) Lost (ctx context.Context , client * kgo.Client , topics map [string ][]int32 ) {
83+ l .revoke (ctx , client , topics )
84+ }
85+
86+ // Revokes all partitions in topics. It expects just one topic and panics if
87+ // topics contains more than one topic.
88+ func (l * partitionLifecycler ) revoke (_ context.Context , _ * kgo.Client , topics map [string ][]int32 ) {
7889 if len (topics ) > 1 {
7990 panic (fmt .Sprintf ("expected one topic, received %d topics" , len (topics )))
8091 }
81- // We expect just one topic, and panic if topics contains more than one
82- // topic. The range over topics just makes it easier to access the first
83- // value in a map containing a single key.
92+ // The range over topics just makes it easier to access the first value
93+ // in a map containing a single key.
8494 for _ , partitions := range topics {
8595 l .partitionManager .Revoke (partitions )
8696 l .usage .EvictPartitions (partitions )
8797 }
8898}
8999
90- // Lost implements kgo.OnPartitionsLost.
91- func (l * partitionLifecycler ) Lost (_ context.Context , _ * kgo.Client , topics map [string ][]int32 ) {
92- for _ , partitions := range topics {
93- for _ , partition := range partitions {
94- // TODO(grobinson): Implement logic to handle partition loss.
95- // For now, we just log the event to measure if it happens at all.
96- level .Warn (l .logger ).Log ("msg" , "partition lost" , "partition" , partition )
97- }
98- }
99- }
100-
101100func (l * partitionLifecycler ) determineStateFromOffsets (ctx context.Context , partition int32 ) error {
102101 logger := log .With (l .logger , "partition" , partition )
103102 // Get the start offset for the partition. This can be greater than zero
0 commit comments