KAFKA-9686 MockConsumer#endOffsets should be idempotent#8255
KAFKA-9686 MockConsumer#endOffsets should be idempotent#8255kkonstantine merged 1 commit intoapache:trunkfrom
Conversation
|
retest this please |
There was a problem hiding this comment.
The code seems intentionally written to store a sequence of end offsets so that each call advances the end offset. If we do not need that capability, then perhaps we can change the type of endOffsets and simplify the usage.
cc @bbejeck Looks like you added this logic. Do you know if we rely on it?
There was a problem hiding this comment.
I agree with @hachikuji 's observation. This test broke when #8220 retired the innerUpdateEndOffsets and replaced the two public methods addEndOffsets and updateEndOffsets that were both using innerUpdateEndOffsets with a single updateEndOffsets. However the version that was kept was actually what the unused addEndOffsets was doing (appending to the end offsets) and not what updateEndOffsets described as an overwrite of the value in endOffsets.
Thus, probably the issue should be fixed in updateEndOffsets to keep meaning overwrite. Unless we find a usage for addEndOffsets, in which case we might need some more adjustments too. Of course, if we keep only updateEndOffsets that overwrites the value of the map, we might as well simplify getEndOffset. I haven't tracked when and why addEndOffsets was stopped being used.
There was a problem hiding this comment.
@hachikuji @kkonstantine thanks for reviews.
Will address your comment :)
kkonstantine
left a comment
There was a problem hiding this comment.
Added also a comment inline, after tracking that this test broke with a consolidation in: #8220
There was a problem hiding this comment.
I agree with @hachikuji 's observation. This test broke when #8220 retired the innerUpdateEndOffsets and replaced the two public methods addEndOffsets and updateEndOffsets that were both using innerUpdateEndOffsets with a single updateEndOffsets. However the version that was kept was actually what the unused addEndOffsets was doing (appending to the end offsets) and not what updateEndOffsets described as an overwrite of the value in endOffsets.
Thus, probably the issue should be fixed in updateEndOffsets to keep meaning overwrite. Unless we find a usage for addEndOffsets, in which case we might need some more adjustments too. Of course, if we keep only updateEndOffsets that overwrites the value of the map, we might as well simplify getEndOffset. I haven't tracked when and why addEndOffsets was stopped being used.
kkonstantine
left a comment
There was a problem hiding this comment.
This LGTM now.
Thanks for addressing this @chia7712 !
I'm merging to trunk
The above code has two issues.
https://issues.apache.org/jira/browse/KAFKA-9686
The following flaky is fixed by this PR
Committer Checklist (excluded from commit message)