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

   ### Motivation
   
   When we call `cursor.close` will trigger cursor info persistent, there are 
two steps to persistence( ensure as little data loss as possible ):
   
   -  try to persist to Bookie
   -  if Bookie doesn't work, try to persist to ZK
   
   ----
   
   But there's something wrong with this code, here's how we want it to work:
   
   1. change state to closing
   2. try to persist to BK
   3. if Bookie doesn't work, try to persist to ZK
   4. change state to closed
   
   ----
   
   (<strong>High light</strong>) Here's how it exactly works:
   
   1. change state to closing
   2. try to persist to BK
   3. (<strong>High light</strong>) race condition
   3-1. if Bookie doesn't work, try to persist to ZK. (<strong>High 
light</strong>) this command asynchronously works on thread `bk client worker`, 
and will fail caused of cursor state check(see code below).
   3-2. change state to closed
   
   
https://github.com/apache/pulsar/blob/b0909aba5398481278f27f185955fb820502e402/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java#L2474-L2478
   
   ### Modifications
   
   Make `change cursor state to closing` always be executed after persistence
   
   
   ### Documentation
   
   
   - [ ] `doc-required` 
     
   - [x] `doc-not-needed` 
     
   - [ ] `doc` 
   
   - [ ] `doc-complete`
   


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