poorbarcode commented on PR #21144: URL: https://github.com/apache/pulsar/pull/21144#issuecomment-1713108733
@codelipenghui > How about the connection being broken? Both the broker and client will handle the channelInactive event. However, the order of completion remains unknown to us. If the broker hasn't done the cleanup job from the broken connection, but the client tries to re-create the producer with a new connection. Will the client still get a producer already connected error? > Maybe we should fix both of them? The client always uses the same connection only when the connection is not available. The broker should make sure the same producer with a newer epoch can fence the existing producer with an older epoch. I pushed a new PR https://github.com/apache/pulsar/pull/21155 to improve the method `Producer.isSuccessorTo`. It does these two improvements: - If a producer with the same name tries to use a new connection: let the client retry and async checks if the old connection is available(The producers related to the unavailable connection will be automatically cleaned up). - Since multiple producers created by the same client will have different `producer-id,` the same producer will use the same connection. We can just use `connection + producer-id` to check whether the new producer can override the old one. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
