[fix][broker][branch-2.11] fix delete_when_subscriptions_caught_up doesn't work while have active consumers
Motivation
The current behavior for the delete_when_subscriptions_caught_up strategy is not expected. The active consumer will not be closed even if users enable delete_when_subscriptions_caught_up and there are no backlogs for the topic.
It should be the part that #6077 has missed. And Sijie has mentioned in the comment https://github.com/apache/pulsar/pull/6077#pullrequestreview-344643883.
To correct the behavior of delete_when_subscriptions_caught_up
Modifications
Close active consumers if delete_when_subscriptions_caught_up is applied and there are no backlogs for the topic. So that the topic can be cleaned up properly by the topic GC thread.
Verifying this change
Updated the existing test.
Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes
- [ ] Dependencies (add or upgrade a dependency)
- [ ] The public API
- [ ] The schema
- [ ] The default values of configurations
- [ ] The threading model
- [ ] The binary protocol
- [ ] The REST endpoints
- [ ] The admin CLI options
- [ ] Anything that affects deployment
Documentation
- [ ]
doc - [ ]
doc-required - [x]
doc-not-needed - [ ]
doc-complete
/pulsarbot run-failure-checks