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

[fix] [broker] In Key_Shared mode: remove unnecessary mechanisms of message skip to avoid unnecessary consumption stuck #20335

Merged
merged 1 commit into from May 19, 2023

Conversation

poorbarcode
Copy link
Contributor

Motivation

#10762 and #7553 do the same thing and #10762 is better than #7553 , so #7553 is unnecessary.

Modifications

remove the mechanism provided by #7553 to avoid unnecessary consumption stuck.

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository:

  • x

Copy link
Contributor

@equanz equanz left a comment

Choose a reason for hiding this comment

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

LGTM

I'll remove duplicated changes from #20179 when this PR is merged. (By the way, if you could, please check the new comments #20179 (comment) ?)

@poorbarcode
Copy link
Contributor Author

@equanz

By the way, if you could, please check the new comments #20179 (comment) ?

Sorry, I've been so busy lately. I left a comment to you #20179 (comment)

@poorbarcode poorbarcode merged commit 1e664b7 into apache:master May 19, 2023
60 of 64 checks passed
poorbarcode added a commit that referenced this pull request May 19, 2023
…essage skip to avoid unnecessary consumption stuck (#20335)

- #7105 provide a mechanism to avoid a stuck consumer affecting the consumption of other consumers:
  - if all consumers can not accept more messages, stop delivering messages to the client.
  - if one consumer can not accept more messages, just read new messages and deliver them to other consumers.
- #7553 provide a mechanism to fix the issue of lost order of consumption: If the consumer cannot accept any more messages, skip the consumer for the next round of message delivery because there may be messages with the same key in the replay queue.
- #10762 provide a mechanism to fix the issue of lost order of consumption: If there have any messages with the same key in the replay queue, do not deliver the new messages to this consumer.

#10762 and #7553 do the same thing and #10762 is better than #7553 , so #7553 is unnecessary.

remove the mechanism provided by #7553 to avoid unnecessary consumption stuck.

(cherry picked from commit 1e664b7)
@lhotari
Copy link
Member

lhotari commented May 22, 2023

@poorbarcode just curious to know if the logic that was removed in this PR was causing problems. Is this PR an optimization or a bug fix?

@poorbarcode
Copy link
Contributor Author

@lhotari

Is this PR an optimization or a bug fix?

I think it should be called a fix.

just curious to know if the logic that was removed in this PR was causing problems.

If there have two consumers [c1, c2] on the same subscription, and there have some messages in the Replay Queue, and the c1 was stuck by the client and its permits came to 0, the consumer c2 will not receive any messages in the Replay Queue, it caused by the nextStuckConsumers is not empty(c1), then Dispatcher will try to read new messages, but there are no new messages now.

@lhotari lhotari added the type/bug The PR fixed a bug or issue reported a bug label May 23, 2023
@lhotari
Copy link
Member

lhotari commented May 23, 2023

@lhotari

Is this PR an optimization or a bug fix?

I think it should be called a fix.

@poorbarcode Thanks for providing these details. I added the respective label. Please also update the PR description to reflect the fact that this is a bug fix.

just curious to know if the logic that was removed in this PR was causing problems.

If there have two consumers [c1, c2] on the same subscription, and there have some messages in the Replay Queue, and the c1 was stuck by the client and its permits came to 0, the consumer c2 will not receive any messages in the Replay Queue, it caused by the nextStuckConsumers is not empty(c1), then Dispatcher will try to read new messages, but there are no new messages now.

Do you have a way to reproduce the problem and test that the fix is effective? Would you also be able to share those details? It would be useful to improve the unit & integration tests to cover such issues. I understand that the scaffolding for such tests is limited and I'm not a great fan of excessive mocking for simulating scenarios. However, providing more context for others in the community would be helpful.

@lhotari
Copy link
Member

lhotari commented May 23, 2023

@codelipenghui @massakam do you have a chance to do a post-merge review since you have worked a lot on Key_Shared?

@lhotari lhotari requested review from massakam and nkurihar May 23, 2023 10:49
@codelipenghui
Copy link
Contributor

@lhotari It looks good to me #10762 covered the fix that #7553 do and this PR doesn't revert the tests introduced by #7553.

Technoboy- pushed a commit that referenced this pull request May 24, 2023
…essage skip to avoid unnecessary consumption stuck (#20335)

### Motivation
- #7105 provide a mechanism to avoid a stuck consumer affecting the consumption of other consumers: 
  - if all consumers can not accept more messages, stop delivering messages to the client.
  - if one consumer can not accept more messages, just read new messages and deliver them to other consumers.
- #7553 provide a mechanism to fix the issue of lost order of consumption: If the consumer cannot accept any more messages, skip the consumer for the next round of message delivery because there may be messages with the same key in the replay queue.
- #10762 provide a mechanism to fix the issue of lost order of consumption: If there have any messages with the same key in the replay queue, do not deliver the new messages to this consumer.

#10762 and #7553 do the same thing and #10762 is better than #7553 , so #7553 is unnecessary. 

### Modifications
remove the mechanism provided by #7553 to avoid unnecessary consumption stuck.
@lhotari
Copy link
Member

lhotari commented May 29, 2023

@lhotari It looks good to me #10762 covered the fix that #7553 do and this PR doesn't revert the tests introduced by #7553.

@codelipenghui @poorbarcode the part I'm wondering is the lack of tests for reproducing the problem that this PR intends to fix. Is there a way to add a test for this PR? /cc @Technoboy-

lhotari pushed a commit to datastax/pulsar that referenced this pull request May 29, 2023
…essage skip to avoid unnecessary consumption stuck (apache#20335)

- apache#7105 provide a mechanism to avoid a stuck consumer affecting the consumption of other consumers:
  - if all consumers can not accept more messages, stop delivering messages to the client.
  - if one consumer can not accept more messages, just read new messages and deliver them to other consumers.
- apache#7553 provide a mechanism to fix the issue of lost order of consumption: If the consumer cannot accept any more messages, skip the consumer for the next round of message delivery because there may be messages with the same key in the replay queue.
- apache#10762 provide a mechanism to fix the issue of lost order of consumption: If there have any messages with the same key in the replay queue, do not deliver the new messages to this consumer.

apache#10762 and apache#7553 do the same thing and apache#10762 is better than apache#7553 , so apache#7553 is unnecessary.

remove the mechanism provided by apache#7553 to avoid unnecessary consumption stuck.

(cherry picked from commit 1e664b7)
(cherry picked from commit c973603)
@poorbarcode
Copy link
Contributor Author

poorbarcode commented May 29, 2023

@lhotari

the part I'm wondering is the lack of tests for reproducing the problem that this PR intends to fix. Is there a way to add a test for this PR?

I will do this, but it is not easy to reproduce in test. So will not soon.

poorbarcode added a commit that referenced this pull request May 30, 2023
…essage skip to avoid unnecessary consumption stuck (#20335)

### Motivation
- #7105 provide a mechanism to avoid a stuck consumer affecting the consumption of other consumers:
  - if all consumers can not accept more messages, stop delivering messages to the client.
  - if one consumer can not accept more messages, just read new messages and deliver them to other consumers.
- #7553 provide a mechanism to fix the issue of lost order of consumption: If the consumer cannot accept any more messages, skip the consumer for the next round of message delivery because there may be messages with the same key in the replay queue.
- #10762 provide a mechanism to fix the issue of lost order of consumption: If there have any messages with the same key in the replay queue, do not deliver the new messages to this consumer.

#10762 and #7553 do the same thing and #10762 is better than #7553 , so #7553 is unnecessary.

### Modifications
remove the mechanism provided by #7553 to avoid unnecessary consumption stuck.

(cherry picked from commit 1e664b7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants