Skip to content
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

Open
wants to merge 6 commits into
base: trunk
Choose a base branch
from

Conversation

ctan888
Copy link
Contributor

@ctan888 ctan888 commented Feb 21, 2020

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.

@ctan888 ctan888 changed the title Log clearer error messages when there is an offset out of range (Broker Change) KAFKA-9591: Log clearer error messages when there is an offset out of range (Broker Change) Feb 21, 2020
@ctan888 ctan888 changed the title KAFKA-9591: Log clearer error messages when there is an offset out of range (Broker Change) KAFKA-9580: Log clearer error messages when there is an offset out of range (Broker Change) Feb 21, 2020
Copy link
Contributor

@soondenana soondenana left a 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).

core/src/main/scala/kafka/log/Log.scala Outdated Show resolved Hide resolved
@ctan888 ctan888 changed the title KAFKA-9580: Log clearer error messages when there is an offset out of range (Broker Change) KAFKA-9580: Log clearer error messages when there is an offset out of range (Broker & Client Change) Mar 5, 2020
Copy link
Contributor

@hachikuji hachikuji left a 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.

@ctan888 ctan888 force-pushed the BrokerChange branch 3 times, most recently from a04aa55 to 67f4bd7 Compare March 17, 2020 16:18
Copy link
Contributor

@soondenana soondenana left a 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.

Copy link
Contributor

@soondenana soondenana left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants