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

   ### Motivation
   
   After a consumer calls `seek`, the operation `reconnect` will get a fenced 
error, which leads to more unnecessary reconnects. The steps to produce are as 
follows:
   
   - `client-side`: consumer connected
   - `client-side`: calls `consumer.seek` or `seekAsync`
   - `broker-side`: mark subscription as `fenced`
     - remove all consumer
     - do reset the cursor internally
   -`client-side`: consumer tries to reconnect
     - get an error Subscription was fenced due to the task `reset cursor` not 
finished yet.
   - `broker-side`: `reset cursor` is completed
   - `client-side`: The consumer tries to reconnect, and it will finish at this 
time.
   
   
   ### Modifications
   
   - This PR fixes the issue that a consumer fenced itself.
   - This PR can probably fix the issue that a `consumer.seek` fenced other 
consumers under the same subscription.
     - This PR does not fix all scenarios in which a `consumer.seek` fenced 
other consumers under the same subscription. See the following example:
   
   | time | `broker-side: consumer_1` | `broker-side: consumer_2` |
   | --- | --- | --- |
   | 1 | | check whether an in-progress reset cursor exists: `false` |
   | 2 | | start to add `consumer_2` |
   | 3 | `reset cursor` started |
   | 4 | mark subscription as `fenced` |
   | 5 | | get a fenced error | 
   
   I do not want to improve the behavior above because it needs a lock. Since 
it does not cause critical errors, it just causes reconnection and the 
possibility of it occurring is low, we can leave it there.
   
   
   ### 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