I use segmentio/kafka-go (v0.4.40) to work with kafka.
reader := kafka.NewReader(kafka.ReaderConfig{
Brokers: []string{broker},
GroupTopics: []string{topic},
GroupID: "group",
MinBytes: cfg.MinBytes,
MaxBytes: cfg.MaxBytes,
QueueCapacity: cfg.QueueCapacity,
SessionTimeout: cfg.SessionTimeout,
MaxAttempts: cfg.MaxAttempts,
Logger: kafka.LoggerFunc(log.New(log.Writer(), "[kafka reader] ", 0).Printf),
})
While the application was running, the directories where the topic data is stored were cleared. Errors appeared in the logs:
error initializing the Kafka reader for partition. Offset Output out of range: requested offset is outside the range offsets maintained by the server for the given topic\partition
I found a description of the problem click and the message says that a flag OffsetOutOfRangeError
has been added.
But I don't understand how this can help in the solution - it seems to me that restarting the application is equivalent to an error that will be received if OffsetOutOfRangeError=true
. But if I restart the app, I still get the same errors. How do I fix them?