-
Notifications
You must be signed in to change notification settings - Fork 346
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[fix] [client] fix same producer/consumer use more than one connection per broker #1323
Conversation
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.
I see the ACK requests still use pc._getConn()
and RequestOnCnx
or RequestOnCnxNoWait
in some places, should they use RequestWithCnxKeySuffix
as well?
Or at least should we call _setConn(nil)
when the consumer unregisters itself from the connection? For example, https://github.com/apache/pulsar/blob/5a3a1f169a7f90181bd5c213c8e9f479bc74f0f2/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConnectionHandler.java#L194
No need, in grabConn will reset conx |
Yes, the consumer's connection is called after the Subscribe RPC is done. When a partition consumer (
What I have concern is, before the There is another possible case that Ideally, I think the best solution is to call |
Co-authored-by: Zike Yang <zike@apache.org>
hi, @BewareMyPower
In this PR, I will throw an error when the connection is null. In a future PR, I will implement the retry logic. |
I just think it again. Resetting |
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.
LGTM
+1. I don't think we need to reimplement the retry logic. If there are connection errors when handling API requests, we shouldn't throw an error. We can just put it back to the event queue and wait for the reconnection to complete. |
Motivation
This is a catch up for apache/pulsar#21144
When a producer or consumer reconnects, a random number will be generated as the key suffix in
ConnectionPool
to create or get theConnection
object from the pool.pulsar-client-go/pulsar/internal/connection_pool.go
Lines 159 to 160 in ffba2a8
Modifications
Verifying this change