Skip to content
Open
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
10 changes: 8 additions & 2 deletions partition_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/IBM/sarama"
"github.com/hashicorp/go-multierror"

"github.com/lovoo/goka/multierr"
"github.com/lovoo/goka/storage"
)
Expand Down Expand Up @@ -329,8 +330,13 @@ func (p *PartitionTable) load(ctx context.Context, stopAfterCatchup bool) (rerr
defer p.log.Debugf("... Loading done")

partConsumer, err = p.consumer.ConsumePartition(p.topic, p.partition, loadOffset)
if err != nil {
return fmt.Errorf("Error creating partition consumer for topic %s, partition %d, offset %d: %v", p.topic, p.partition, storedOffset, err)
if err == sarama.ErrOffsetOutOfRange {
p.log.Printf("Offset %d out of range for topic %s, partition %d. Falling back to oldest offset.", loadOffset, p.topic, p.partition)

partConsumer, err = p.consumer.ConsumePartition(p.topic, p.partition, sarama.OffsetOldest)
if err != nil {
return fmt.Errorf("Error creating partition consumer for topic %s, partition %d, offset %d: %v", p.topic, p.partition, storedOffset, err)
}
}

// close the consumer
Expand Down