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-16433: BeginningAndEndOffsets and OffsetsForTimes should send an event and return empty with zero timeout provided #15688

Merged
merged 1 commit into from Apr 10, 2024

Conversation

philipnee
Copy link
Collaborator

beginningOrEndOffset and offsetforTimes should send a ListOffsetEvent and return empty results if the provided timeout is zero.

A minor change to the mock timer with zero timeout in AsyncConsumerTest.

@philipnee philipnee requested a review from lucasbru April 9, 2024 17:38
Copy link
Member

@lucasbru lucasbru 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!

@lucasbru lucasbru merged commit e5a3f99 into apache:trunk Apr 10, 2024
1 check failed
@kirktrue
Copy link
Contributor

@philipnee—sorry I'm late to the party, but why do we submit the event to the queue when the timeout is 0?

@philipnee
Copy link
Collaborator Author

Hi @kirktrue - It was clearly documented why LegacyKafkaConsumer would do this, maybe it is because in some scenarios users want to update the position but actually don't care about the offset results. This is the snippet from the LegacyKafkaConsumer code:

          // if timeout is set to zero, do not try to poll the network client at all
            // and return empty immediately; otherwise try to get the results synchronously
            // and throw timeout exception if it cannot complete in time
            if (timer.timeoutMs() == 0L)
                return result;

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