codelipenghui commented on issue #5719: Remove cursor while remove non-durable 
subscription
URL: https://github.com/apache/pulsar/pull/5719#issuecomment-557966126
 
 
   We need an approach related to seek position, current approach will close 
all consumers while seek position happens,  but this PR will remove the 
non-durable cursor while all consumers of the non-durable subscription are 
disconnected. So the reconnected consumer will create a new non-durable cursor 
using last message id, the unit test can't passed.
   
   It's better to have an approach to handle the position seek, there are two 
point we need to careful handling:
   1. Consumers acknowledge by `outstanding` message ids
   2. Avoid consumer to process the `outstanding` messages
   
   Here, the outstanding messages means messages already dispatched to 
consumers but the cursor is reset.
   
   For the first point, i think we can use the `read position`, the `read 
position` always larger than the mark delete position except the cursor reset 
happens, so if the broker ignore the acknowledge requests which the acknowledge 
position is larger than `read position`, because there is cursor reset happens.
   
   For the second point, if the consumer cache to many outstanding messages, 
it's waste of resources if process all of these messages, so it's better to 
send a cursor reseted notify to consumers before dispatch messages after the 
cursor reset to consumers, consumers can reset their stat, clear the 
outstanding messages. currently close consumers also can reset consumer state, 
clear outstanding messages.
   
   And in https://github.com/apache/pulsar/pull/5278, we also have discussed 
about the reset consumer state when cursor reset happens.
   
   For this PR, i think we can don't close the readers first, and then create a 
new PR to improve cursor reset since it might need to change the wire protocol.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to