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

   ### Motivation
   
   In the current implementation, if the managed cursor `readPosition` is 
greater than the maximum ledger position, the `readPosition` will increment to 
infinity. 
   You can use the new test `testReadPositionUpdateOverflow` to verify this 
condition.
   
   e.g.
   ```java
   java.lang.AssertionError: 
   Expected :8:0
   Actual   :58:0
   <Click to see difference>
   ```
   I'm not sure what condition would increase the read position by more than 
the max ledger. But I think it's worth supporting this mechanism to prevent 
this from happening.
   
   > We can keep looking for another logic that might set `readPosition` to be 
larger than the largest ledger.
   
   ### Modifications
   
   - Move the old logic in `startReadOperationOnLedger` to `asyncReadEntries` 
to make the `OpReadEntry` more clear.
   - If `readPosition` grater than the maximum ledger id throw 
`ManagedLedgerException.NoMoreEntriesToReadException`.
   
   ### Verifying this change
   
   - [x] Make sure that the change passes the CI checks.
   
   Add new test `testReadPositionUpdateOverflow` to verify this change.
   
   ### Documentation
   
   - [x] `doc-not-needed` 
   (Please explain why)
     
   


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