-
Notifications
You must be signed in to change notification settings - Fork 13.6k
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
KAFKA-9580: Log clearer error messages when there is an offset out of range (Broker & Client Change) #8152
base: trunk
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may have to also update code where this exception is handled (ReplicaManager).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, left some comments.
.../src/main/java/org/apache/kafka/common/errors/OffsetOutOfRangeExceptionWithOffsetValues.java
Outdated
Show resolved
Hide resolved
clients/src/main/java/org/apache/kafka/clients/consumer/internals/Fetcher.java
Outdated
Show resolved
Hide resolved
clients/src/main/java/org/apache/kafka/clients/consumer/internals/Fetcher.java
Outdated
Show resolved
Hide resolved
a04aa55
to
67f4bd7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall. Left couple of comments.
clients/src/main/java/org/apache/kafka/clients/consumer/internals/Fetcher.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Thanks for adding the tests.
More detailed description of your change
Broker side: Added an Info level log when throwing the offsetOutOfRangeException in log.scala. Also, utilized a new error class OffsetOutOfRangeExceptionWithOffsetValues, a subclass of OffsetOutOfRangeException, as a media to pass offset values into the response to the consumer client.
Client side: Added an Info level log when the fetcher gets OffsetOutOfRangeExceptionWithOffsetValues, which is the subclass of OffsetOutOfRangeException.
Summary of testing strategy (including rationale)
I changed the source code and deliberately threw offsetOutOfRangeException on the broker side. Then, I started the kafka console producer & consumer and receives:
INFO [Log partition=test-0, dir=/tmp/kafka-logs] Received request for offset 0 for partition test-0, but we only have log segments in the range 0 to 40. (kafka.log.Log)
on the broker console and
INFO [Consumer clientId=consumer-console-consumer-28016-1, groupId=console-consumer-28016] Fetch offset 0 is out of range for partition test-0. We only have log segments in the range from 0 to 40. Resetting offset (org.apache.kafka.clients.consumer.internals.Fetcher)
on the client console, which means the client successfully gets the logStartOffset and lastStableOffset of the partition, even when the broker throws OffsetOutOfRangeException.