Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions internal/pkg/pipeline/task/kafka/kafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@ func (k *kafka) buildConsumerConfig() (*ckafka.ConfigMap, error) {
}

_ = cfg.SetKey("auto.offset.reset", k.AutoOffsetReset)
_ = cfg.SetKey("partition.assignment.strategy", "cooperative-sticky")
_ = cfg.SetKey("session.timeout.ms", 30000)
_ = cfg.SetKey("heartbeat.interval.ms", 3000)
_ = cfg.SetKey("enable.auto.offset.store", false)
Expand Down
18 changes: 12 additions & 6 deletions internal/pkg/pipeline/task/kafka/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,10 @@ func (k *kafka) Finish() error {
if r.group {
for partition, offset := range r.offsets.commitPositions() {
if err := r.storeOffset(partition, offset); err != nil {
fmt.Printf("warning: failed to store offset for topic %s partition %d: %v\n",
k.Topic, partition, err)
if kErr, ok := err.(ckafka.Error); !ok || kErr.Code() != ckafka.ErrState {
fmt.Printf("warning: failed to store offset for topic %s partition %d: %v\n",
k.Topic, partition, err)
}
}
}

Expand Down Expand Up @@ -149,8 +151,10 @@ func (r *reader) handleRecord(ctx context.Context, data []byte, output chan<- *r
commitTo, shouldStore, _ := r.offsets.settle(partition, offset, false)
if shouldStore {
if err := r.storeOffset(partition, commitTo); err != nil {
fmt.Printf("warning: failed to store offset for topic %s partition %d: %v\n",
r.k.Topic, partition, err)
if kErr, ok := err.(ckafka.Error); !ok || kErr.Code() != ckafka.ErrState {
fmt.Printf("warning: failed to store offset for topic %s partition %d: %v\n",
r.k.Topic, partition, err)
}
}
}
return
Expand All @@ -175,8 +179,10 @@ func (m *messageAck) Ack(failed bool) {
commitTo, shouldStore, pause := m.reader.offsets.settle(m.partition, m.offset, failed)
if shouldStore {
if err := m.reader.storeOffset(m.partition, commitTo); err != nil {
fmt.Printf("warning: failed to store offset for topic %s partition %d: %v\n",
m.reader.k.Topic, m.partition, err)
if kErr, ok := err.(ckafka.Error); !ok || kErr.Code() != ckafka.ErrState {
fmt.Printf("warning: failed to store offset for topic %s partition %d: %v\n",
m.reader.k.Topic, m.partition, err)
}
}
}

Expand Down
Loading