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

   ### Motivation
   
   | time | client | broker |
   | --- | --- | --- |
   | 1 | | Unload topic |
   | 2 | Subscribe after disconnect |
   | 3 | | Initialize ManagedLedger. This operation is slowly |
   | 4 | Subscribe timeout, try to close the consumer |
   | 5 | | Remove `consumerFuture` from `ServerCnx`, then the mechanism to 
prevent registering a consumer with the same id is invalid now | 
   | 6 | | Initialize ManagedLedger finish, add the consumer to 
`dispatcher.consumerSet` and `dispatcher.consumerList` |
   | 7 | Retry to subscribe |
   | 8 | | Add the consumer to `dispatcher.consumerSet` and 
`dispatcher.consumerList` the second time. `consumerSet` has one item(the 
collection Set will merge two items into one), and `consumerList` has two items 
now. |
   | 9 | | Failed to complete the first Consumer Future, calls 
`consumerSet.remove(consumer)` and `consumerList.remove(consumer)` |
   | 10 | | `consumerSet.size` is `0`, `consumerList.size` is `1` |
   
   This issue may cause a stuck of dispatchers closing/unsubscribing and topic 
closing/deleting. See more context: https://github.com/apache/pulsar/pull/22270
   
   ### Modifications
   
   - If the first subscribe is complete before the second subscribe:
     - Make both operations fail, and the client will retry again, the third 
subscribe will be successful.
   - If the first subscribe is complete before the second subscribe:
     - Make the first subscribe fail, and the second subscribe will be 
successful.
   
   ### Documentation
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   - [ ] `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