-
Notifications
You must be signed in to change notification settings - Fork 754
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
reader doesn't recover (quickly) from OffsetOutOfRange "Offset Out Of Range" #891
Comments
Provide a new configuration `AutoOffsetReset` that can be used to reset the non-group-id reader's offset when the topic has been recreated (or the current offset is no longer valid for any reason). The `AutoOffsetReset` can have a value of 0 (no action), or FirstOffset / LastOffset. Added a new test case in `TestReader` to verify that, on setting the offset initially past the last offset in the topic, the reader will restart from the beginning once it detects this OffsetOutOfRange error, instead of perpetually reporting OffsetOutOfRange and waiting for the producer to catch up. Fixes segmentio#891.
Provide a new configuration `AutoOffsetReset` that can be used to reset the non-group-id reader's offset when the topic has been recreated (or the current offset is no longer valid for any reason). The `AutoOffsetReset` can have a value of 0 (no action), or FirstOffset / LastOffset. Added a new test case in `TestReader` to verify that, on setting the offset initially past the last offset in the topic, the reader will restart from the beginning once it detects this OffsetOutOfRange error, instead of perpetually reporting OffsetOutOfRange and waiting for the producer to catch up. Fixes segmentio#891.
Provide a new configuration `AutoOffsetReset` that can be used to reset the non-group-id reader's offset when the topic has been recreated (or the current offset is no longer valid for any reason). The `AutoOffsetReset` can have a value of 0 (no action), or FirstOffset / LastOffset. Added a new test case in `TestReader` to verify that, on setting the offset initially past the last offset in the topic, the reader will restart from the beginning once it detects this OffsetOutOfRange error, instead of perpetually reporting OffsetOutOfRange and waiting for the producer to catch up. Fixes segmentio#891.
Provide a new configuration `AutoOffsetReset` that can be used to reset the non-group-id reader's offset when the topic has been recreated (or the current offset is no longer valid for any reason). The `AutoOffsetReset` can have a value of 0 (no action), or FirstOffset / LastOffset. Added a new test case in `TestReader` to verify that, on setting the offset initially past the last offset in the topic, the reader will restart from the beginning once it detects this OffsetOutOfRange error, instead of perpetually reporting OffsetOutOfRange and waiting for the producer to catch up. Fixes segmentio#891.
What's the use-case for having a topic re-created on the fly? This seems like it might be mostly useful during development, but that is just speculation on my part. With that in mind, I'm more inclined to return an error (allowing the program to crash and restart) than to include logic that will automatically recover, as it seems to be an edge-case. I'll bring this up on the PR as well, we can have further discussion there. |
Describe the bug
I had a case where the kafka topic was recreated. I am not using a consumer group for this topic, and so it reports, e.g.
Kafka Version
3.0.0
0.4.30
To Reproduce
docker-compose up -d
go run ./consumer.go
docker-compose rm -vfs kafka; docker-compose up -d
docker-compose.yaml
consumer.go
Expected Behavior
Either the
ReadMessage
call should return with an error, or the reader should gracefully restart at a valid offset.Observed Behavior
Perpetual output of
error initializing the kafka reader for partition 0
message, reader never resumes reading until the offset is once again where it was (this could be a matter of days).Additional Context
probelmatic code from reader.go
The text was updated successfully, but these errors were encountered: