fix: Stop disconnecting consumers from MultiTopicConsumer on connection errors if not using regex #379
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A MultiTopicConsumer contains many child Consumers, one for every partitioned topic, and when you poll the MultiTopicConsumer it polls all child consumers until a new message is ready.
This works great in non-error conditions, but in some rare cases, such as when one or more pulsar brokers are restart in sequence, the child consumer can return
Poll::Ready(Some(Err(e)))The previous behavior was to assume the child consumer was dead and to remove it from the MultiTopicConsumer. This is reasonable if you are using the regex refresh feature, where topics will be discovered at runtime dynamically. However, this is completely the wrong behavior when you have a fixed topic list at startup. Silently dropping a child topic means your MultiTopicConsumer will never listen to that topic ever again.
There is no test included, as an automated test that shut down the entire broker during a test would not behave well locally/CI. It was tested with the example included in the issue - https://github.com/chamons/pulsar-load-shed-repro