-
Notifications
You must be signed in to change notification settings - Fork 15.4k
KAFKA-9840: Skip End Offset validation when the leader epoch is not reliable #8486
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
Changes from 4 commits
fddb49e
dbaa133
94e0911
03407c4
a6c0785
6a66b1b
1a97ccc
87ca234
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,9 +40,7 @@ public EpochEndOffset(Errors error, int leaderEpoch, long endOffset) { | |
| } | ||
|
|
||
| public EpochEndOffset(int leaderEpoch, long endOffset) { | ||
| this.error = Errors.NONE; | ||
| this.leaderEpoch = leaderEpoch; | ||
| this.endOffset = endOffset; | ||
| this(Errors.NONE, leaderEpoch, endOffset); | ||
| } | ||
|
|
||
| public Errors error() { | ||
|
|
@@ -86,4 +84,9 @@ public boolean equals(Object o) { | |
| public int hashCode() { | ||
| return Objects.hash(error, leaderEpoch, endOffset); | ||
| } | ||
|
|
||
| public boolean hasUndefinedEpochOrOffset() { | ||
| return this.endOffset == UNDEFINED_EPOCH_OFFSET || | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For my own understanding: if endOffset is UNDEFINED the epoch should always be UNDEFINED too? If that's the case we can just rely on
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just feel this check is stronger if later we change the behavior on broker.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Older versions did not return the epoch, so it was possible to see an offset defined without an epoch. However, the version that the consumer relies on should always have both or neither. Anyway, I think it is reasonable to be a little stricter here. |
||
| this.leaderEpoch == UNDEFINED_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.
Didn't notice this before, but this is handled inside a loop. If one partition hits an error, then the raised exception will prevent us from completing the validation for other partitions.