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

consumer: fix consumeNum to respect consume timeout #1053

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

katreniak
Copy link

@katreniak katreniak commented Nov 7, 2023

Steps to reproduce the problem:

  • configure consumer with setDefaultConsumeTimeout(1000)
  • produce 1 message every 500ms
  • call consumer.consume(128, cb)

Actual outcome:

  • consume returns batch of 128 messages after 64 seconds

Expected outcome:

  • consumer returns batch of ~2 messages after 1 second

KafkaConsumerConsumeNum call underlaying c++ m_consumer->Consume
in cycle until

  • either the accumulated batch is full
  • or the call to c++ m_consumer->Consume times out on the total timeout

KafkaConsumerConsumeNum must enforce its timeout
over all m_consumer->Consume invocations altogether.

One round poll to broker is needed to read the message.
Second round poll to broker is needed to detect EOF.

The test is asserting that we get message and EOF within 2s.
But the consumer is configured with 'fetch.wait.max.ms': 1000.
We don't fit 2 timout out polls within 2s.

We need to increase the consume timeout to 3s.
One round poll to broker is needed to read the message.
Second round poll to broker is needed to detect EOF.

The test is asserting that we get EOF, data and EOF
when data is produced at 2nd second.

But the consumer is configured with 'fetch.wait.max.ms': 1000.
We read the data in poll to broker slightly after 3rd second.
We detect the 2nd EOF slightly after 4th second.

We need to increase the consume timeout to 5s.
Steps to reproduce:
* configure consumer with setDefaultConsumeTimeout(1000)
* produce 1 message every 500ms
* call consumer.consume(128, cb)

Actual outcome:
* consume returns 128 messages after 64 seconds

Expected outcome:
* consumer returns ~2 messages after 1 second

KafkaConsumerConsumeNum call underlaying c++ m_consumer->Consume
in cycle until
* either the accumulated batch is full
* or the call to c++ m_consumer->Consume times out on the total timeout

KafkaConsumerConsumeNum must enforce its timeout
over all m_consumer->Consume invocations altogether.
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.

1 participant