-
Notifications
You must be signed in to change notification settings - Fork 13.9k
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-7440 Add leader epoch to fetch and list-offset request #6190
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.
Thanks, left a couple initial comments.
this.metadata.requestUpdate(); | ||
} else if (error == Errors.UNKNOWN_LEADER_EPOCH) { | ||
log.warn("Received unknown leader epoch error in fetch for partition {}", tp); | ||
this.metadata.requestUpdate(); |
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.
I think the metadata update may not be needed. UNKNOWN_LEADER_EPOCH
means the consumer's metadata has gotten ahead of the broker, so we can just retry. The only thing I am not sure is whether we need additional backoff logic before retrying.
@@ -992,6 +997,12 @@ private PartitionRecords parseCompletedFetch(CompletedFetch completedFetch) { | |||
} else if (error == Errors.TOPIC_AUTHORIZATION_FAILED) { | |||
log.warn("Not authorized to read from topic {}.", tp.topic()); | |||
throw new TopicAuthorizationException(Collections.singleton(tp.topic())); | |||
} else if (error == Errors.FENCED_LEADER_EPOCH) { | |||
log.warn("Received fenced leader epoch error in fetch for partition {}", tp); | |||
this.metadata.requestUpdate(); |
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.
Should we invalidate the fenced epoch somehow?
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.
Left a couple comments. Are we going to handle the ListOffsets requests here as well?
@@ -992,6 +997,11 @@ private PartitionRecords parseCompletedFetch(CompletedFetch completedFetch) { | |||
} else if (error == Errors.TOPIC_AUTHORIZATION_FAILED) { | |||
log.warn("Not authorized to read from topic {}.", tp.topic()); | |||
throw new TopicAuthorizationException(Collections.singleton(tp.topic())); | |||
} else if (error == Errors.FENCED_LEADER_EPOCH) { |
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.
We could probably add this to the errors on line 979 above. This is a "normal" error case, so I think we logging at debug level should be sufficient.
log.warn("Received fenced leader epoch error in fetch for partition {}", tp); | ||
this.metadata.requestUpdate(); | ||
} else if (error == Errors.UNKNOWN_LEADER_EPOCH) { | ||
log.warn("Received unknown leader epoch error in fetch for partition {}", tp); |
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.
Could be debug level?
retest this please |
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 the patch.
The failures are known flaky tests. I will go ahead and merge. |
…#6190) As part of KIP-320, we should add the expected leader epoch to Fetch and ListOffsets requests. This will allow us ultimately to detect log truncation. Reviewers: Jason Gustafson <jason@confluent.io>
More detailed description of your change,
if necessary. The PR title and PR message become
the squashed commit message, so use a separate
comment to ping reviewers.
Summary of testing strategy (including rationale)
for the feature or bug fix. Unit and/or integration
tests are expected for any behaviour change and
system tests should be considered for larger changes.
Committer Checklist (excluded from commit message)