-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[consumer] Revert "Remove consumer unnecessary locks (#9261)" #10240
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
Conversation
|
@MarvinCai @codelipenghui @merlimat Please take a look. |
|
@linlinnn I have some doubts here, why we need to guarantee message order across partitions(The MultiTopicsConsumerImpl is consuming messages from multiple partitions)? |
@codelipenghui |
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java
Outdated
Show resolved
Hide resolved
|
I think we should guarantee order by process incoming message from single thread, instead of adding lock which can impact performance due to context switch and wait. |
@MarvinCai |
|
/pulsarbot run-failure-checks |
|
This is indeed a problem When the execution order is 1、4、2、1、3、4, the order of 3 and 4 cannot be guaranteed |
|
Emm...We have orderExecutor CC @hangc0276 |
|
/pulsarbot run-failure-checks |
|
I actually don't see the point of the locking we try to add here. The poll from receiver queue or notify pending request is not the root cause here. The BlockingQueue is itself threadsafe. And no matter which thread does the notification, it'll alway be thread from "pulsar-external-listener" to process pending request. |
|
@merlimat @sijie @codelipenghui any thought on this |
|
@MarvinCai Also, I see the similar lock in the method batch receive. |
|
@eolivelli @codelipenghui @lhotari Please help review this PR, thanks. |
|
Emm.. any feedback : ) @eolivelli @MarvinCai @merlimat @315157973 |
90d8b45 to
ea8c7ae
Compare
|
/pulsarbot run-failure-checks |
1 similar comment
|
/pulsarbot run-failure-checks |
|
CICD passed. Could you please help review if you are available? @lhotari |
389bb9d to
de8a57b
Compare
|
IMO,it’s better to revert first, so that we can easily distinguish whether the flaky unit test is caused by my PR |
+1 |
|
Looks good to me, @linlinnn I think you can use this PR to revert #9261 first. @hangc0276 Please also help take a look. |
a8a3b70 to
0b8288e
Compare
|
@codelipenghui @315157973 I rebase master and revert #9261, PTAL |
eolivelli
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hangc0276 please take a look
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java
Outdated
Show resolved
Hide resolved
|
LGTM, probably it is the hidden cause for many other flaky tests. |
|
But we should still try to improve the performance w/ a lock free solution in a separate issue ASAP. |
|
ping @eolivelli Please help review this PR, this issue makes many tests unstable. |
@MarvinCai Yes, we should continue to improve the performance. @315157973 also works on the lock-free solution. We'd better to revert first and then find a better solution to handle this issue. |
|
@linlinnn Could you please help resolve the conflict? |
982ddfd to
35ab7b2
Compare
|
+1 |
### Motivation Lock-free solution for #10240
### Motivation Lock-free solution for apache#10240
…che#10508) ### Motivation apache#10240 has reverted the changes of the apache#9261 introduced which make the key_shared tests flaky. So it's better to move out the tests from the quarantine group. ### Modifications Move out the key_shared related tests from the quarantine group.
Lock-free solution for apache#10240 (cherry picked from commit def1932)
Lock-free solution for apache#10240 (cherry picked from commit def1932)
Fixes #10222
Fixes #10173
Motivation
fix order guarantee for MultiTopicsConsumerImpl
The cause of out of order:
the origin order of message: 1, 2, 3, 4
receive message 3
Thread
pulsar-client-ioConsumerImplpeek pending receive is null (code link 1)Thread
pulsar-client-internalConsumerImplpoll message is null (code link 4)Thread
pulsar-client-internalConsumerImplpending receive for message 3 (code link 5)Thread
pulsar-client-ioConsumerImploffer message 3 toincomingMessages(code link 3)receive message 4
Thread
pulsar-client-ioConsumerImplsend message 4 notify above pending receive (code link 2)Thread
pulsar-client-internalMultiTopicsConsumerImplaccept message 4Thread
pulsar-client-internalMultiTopicsConsumerImplaccept message 3Modification
Revert "Remove consumer unnecessary locks (#9261)"