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-15842: Correct handling of KafkaConsumer.committed for new consumer #14859

Merged
merged 10 commits into from
Dec 1, 2023

Conversation

AndrewJSchofield
Copy link
Collaborator

This PR fixes some details of the interface to KafkaConsumer.committed which were different between the existing consumer and the new consumer.

Adds a unit test that validates the behaviour is the same for both consumer implementations.

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

@AndrewJSchofield
Copy link
Collaborator Author

Closing and reopening PR to retry failed build.

@AndrewJSchofield
Copy link
Collaborator Author

https://issues.apache.org/jira/browse/KAFKA-15932 opened for flaky test.

Copy link
Collaborator

@kirktrue kirktrue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @AndrewJSchofield!

Thanks for the fix and the associated clean up. One minor nit-ty change requested.

@@ -48,7 +48,7 @@
<suppress id="dontUseSystemExit"
files="Exit.java"/>
<suppress checks="ClassFanOutComplexity"
files="(AbstractFetch|Sender|SenderTest|ConsumerCoordinator|KafkaConsumer|PrototypeAsyncConsumer|KafkaProducer|Utils|TransactionManager|TransactionManagerTest|KafkaAdminClient|NetworkClient|Admin|KafkaRaftClient|KafkaRaftClientTest|RaftClientTestContext).java"/>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this clean up!

@@ -663,6 +662,10 @@ public Map<TopicPartition, OffsetAndMetadata> committed(final Set<TopicPartition
time.timer(timeout));
committedOffsets.forEach(this::updateLastSeenEpochIfNewer);
return committedOffsets;
} catch (TimeoutException e) {
throw new TimeoutException("Timeout of " + timeout.toMillis() + "ms expired before the last " +
"committed offset for partitions " + partitions + " could be determined. Try tuning default.api.timeout.ms " +
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: please replace the literal string default.api.timeout.ms with the appropriate constant from ConsumerConfig 🥺

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I agree with @kirktrue , let's merge this PR and fix this on the side in a follow-up PR.

Comment on lines -656 to +655
return new HashMap<>();
return Collections.emptyMap();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this make a difference, or just a stylistic/pet peeve/optimiz/sation thing?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made it strictly identical to the previous implementation.

Comment on lines -598 to +599
@MethodSource(Array("getTestQuorumAndGroupProtocolParametersAll"))
@MethodSource(Array("getTestQuorumAndGroupProtocolParametersGenericGroupProtocolOnly"))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😭

Copy link
Contributor

@cadonna cadonna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @AndrewJSchofield !

LGTM!

@cadonna cadonna merged commit 1750d73 into apache:trunk Dec 1, 2023
1 check failed
@AndrewJSchofield AndrewJSchofield deleted the KAFKA-15842 branch December 1, 2023 13:40
ex172000 pushed a commit to ex172000/kafka that referenced this pull request Dec 15, 2023
…umer (apache#14859)

This PR fixes some details of the interface to KafkaConsumer.committed which were different between the existing consumer and the new consumer.

Adds a unit test that validates the behaviour is the same for both consumer implementations.

Reviewers: Kirk True <[email protected]>, Bruno Cadonna <[email protected]>
yyu1993 pushed a commit to yyu1993/kafka that referenced this pull request Feb 15, 2024
…umer (apache#14859)

This PR fixes some details of the interface to KafkaConsumer.committed which were different between the existing consumer and the new consumer.

Adds a unit test that validates the behaviour is the same for both consumer implementations.

Reviewers: Kirk True <[email protected]>, Bruno Cadonna <[email protected]>
AnatolyPopov pushed a commit to aiven/kafka that referenced this pull request Feb 16, 2024
…umer (apache#14859)

This PR fixes some details of the interface to KafkaConsumer.committed which were different between the existing consumer and the new consumer.

Adds a unit test that validates the behaviour is the same for both consumer implementations.

Reviewers: Kirk True <[email protected]>, Bruno Cadonna <[email protected]>
clolov pushed a commit to clolov/kafka that referenced this pull request Apr 5, 2024
…umer (apache#14859)

This PR fixes some details of the interface to KafkaConsumer.committed which were different between the existing consumer and the new consumer.

Adds a unit test that validates the behaviour is the same for both consumer implementations.

Reviewers: Kirk True <[email protected]>, Bruno Cadonna <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants