RobertIndie opened a new pull request, #1437: URL: https://github.com/apache/pulsar-client-go/pull/1437
### Motivation When a partition update is triggered and the creation of one of the new producers fails, it currently fails all existing producers here:https://github.com/apache/pulsar-client-go/blob/148c10c41f37ee1e15bb66d7ba09d2a8984b87b0/pulsar/producer_impl.go#L267-L271 This causes the entire producer to become unavailable. All subsequent produce operations will fail with a "producer already closed" error. ### Modifications Currently, two variables, `producers` and `producersPtr`, are used to manage the producer list inside producer_impl: https://github.com/apache/pulsar-client-go/blob/148c10c41f37ee1e15bb66d7ba09d2a8984b87b0/pulsar/producer_impl.go#L55-L56 Both are accessed across multiple methods inside `producer_impl`, which is misleading and makes `producersPtr` ineffective. This PR addresses the issue by: * Using only `producersPtr` to access the producer list inside `producer_impl`. Only `internalCreatePartitionsProducers` can modify `producersPtr`, which protects the producer list. * Ensuring that during a partition update, new producers are not added to `producersPtr` until all new producers are successfully created. ### Verifying this change This change added tests ### Does this pull request potentially affect one of the following parts: *If `yes` was chosen, please highlight the changes* - Dependencies (does it add or upgrade a dependency): (yes / no) - The public API: (yes / no) - The schema: (yes / no / don't know) - The default values of configurations: (yes / no) - The wire protocol: (yes / no) ### Documentation - Does this pull request introduce a new feature? (yes / no) - If yes, how is the feature documented? (not applicable / docs / GoDocs / not documented) - If a feature is not applicable for documentation, explain why? - If a feature is not documented yet in this PR, please create a followup issue for adding the documentation -- 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]
