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

Subscribing to two or more topics with KEY ordering, results in messages of the same Key never being processed #184

Closed
Tracked by #172
fowlerp-qlik opened this issue Jan 11, 2022 · 4 comments · Fixed by #315
Assignees
Labels
blocker Blocker issue draft-available high verified bug Something isn't working
Milestone

Comments

@fowlerp-qlik
Copy link

fowlerp-qlik commented Jan 11, 2022

Steps to reproduce:

  1. Started zoo keeper and a single broker on my MacBook
  2. Create three topics each with one partition and a replication factor of one. The topic names differ only in the last character
  3. Using a producer program pump 333 messages into each topic with almost no delay
  4. Start up Java program that uses the parallel consumer to subscribe to and consume the messages from the three topics using KEY ordering.
  5. Notice that not all of the messages show up in the polling lambda function and the Kafka topic details show an expected CURRENT-OFFSET for only one of the topics.

If one restarts the java program then additional (but not all) messages are consumed. Restart a couple more times and then all the messages have been consumed the topic details show the correct CURRENT-OFFSET for each topic.

If one deletes/purges the topics and pumps 333 messages into the first topic, then 333 more messages into the first and second topic then 333 each of the three topics then everything works fine.

I enabled trace logging for a subsequent run and see

Returning 3 fetched records at offset FetchPosition{offset=232, offsetEpoch=Optional.empty, currentLeader=LeaderAndEpoch{leader=Optional[192.168.2.58:9092 (id: 0 rack: null)], epoch=0}} for assigned partition myTopicprefix-topic-1-0",

But later in the logs only see one
{"timestamp":"2022-01-05T16:45:43.143Z","message":"asyncPoll - Consumed a record (232)
And
{"timestamp":"2022-01-05T16:45:47.999Z","message":"asyncPoll - user function finished ok.

If the above is performed with just one topic there is no problem. If the above is done with two fresh topics the issue also occurs.

If UNORDERED is used instead of KEY then everything works fine.

@astubbs astubbs self-assigned this Jan 11, 2022
@astubbs astubbs mentioned this issue Feb 1, 2022
64 tasks
@astubbs astubbs added this to the 0.5.1 milestone May 12, 2022
@astubbs
Copy link
Contributor

astubbs commented May 21, 2022

When you say "the Kafka topic details show an expected CURRENT -OFFSET for only one of the topics", do you mean that only one of the topics has an offset committed?

astubbs added a commit to astubbs/parallel-consumer that referenced this issue May 21, 2022
@fowlerp-qlik
Copy link
Author

Correct

@astubbs
Copy link
Contributor

astubbs commented May 24, 2022

Ok, thanks. This is fixed in the linked pr. Will be merging this week.

@astubbs astubbs changed the title Load test with with two or more new topics results in missed messages Sybscriving to two or more new topics results in missed messages May 24, 2022
@astubbs astubbs changed the title Sybscriving to two or more new topics results in missed messages Subscribing to two or more topics with KEY ordering, results in messages of the same Key never being processed May 24, 2022
@astubbs
Copy link
Contributor

astubbs commented May 24, 2022

@astubbs astubbs added draft-available verified bug Something isn't working and removed needs-investigation labels May 24, 2022
astubbs added a commit that referenced this issue Jul 12, 2022
…ic to shard key (#315)

- Try to reproduce issue #184 - run against multiple topics
- Introduce ShardKey
- Test for null keys in KEY ordering - records get queued into a null key queue - see #314
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker Blocker issue draft-available high verified bug Something isn't working
Projects
None yet
2 participants