poorbarcode opened a new pull request, #21853:
URL: https://github.com/apache/pulsar/pull/21853

   ### Motivation
   
   #### Issue
   - Start a consumer subscribe with regexp `public/default/*`
   - Create a new topic `public/default/tp-1`
   - Send messages to the new topic
   - Consumers will not receive any messages, and the messages will be deleted 
due to there are no subscription.
   
   #### Root cause
   
   **Case-1:**
   | Time | Thread `start consumer` | Thread `create topic` |
   | --- | --- | --- |
   | 1 | Start subscribe |
   | 2 | Start to register `TopicListWatcher` | Create new topic |
   | 3 | | Topic created |
   | 4 | | Since there are no listeners registered, there is no need to notice 
clients |
   | 5 | `TopicListWatcher` registered, the consumer will not receive any 
messages from the new topic |
   
   **Case-2:**
   | Time | Thread `TopicListWatcher reconnect` | Thread `create topic` |
   | --- | --- | --- |
   | 1 | Start reconnect |
   | 2 |  | Create new topic |
   | 3 | | Topic created |
   | 4 | | Since there are no listeners registered, there is no need to notice 
clients |
   | 5 | `TopicListWatcher` reconnected |
   | 6 | The consumer will not receive any messages from the new topic |
   
   This issue only affects the releases `>=3.1`, because before `3.1` there is 
a supplementary mechanism `scheduled recheckPatternTimeout`, it makes the 
issues will not occur.  This supplementary mechanism was removed at `3.1`, see 
https://github.com/apache/pulsar/pull/20779
   
   ### Modifications
   - After `TopicListWatcher` reconnected, re-check the topics list.
   
   
   ### Documentation
   
   - [ ] `doc` <!-- Your PR contains doc changes. -->
   - [ ] `doc-required` <!-- Your PR changes impact docs, and you will update 
later -->
   - [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
   - [ ] `doc-complete` <!-- Docs have been already added -->
   
   ### Matching PR in forked repository
   
   PR in forked repository: x
   


-- 
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]

Reply via email to