BewareMyPower commented on code in PR #25110:
URL: https://github.com/apache/pulsar/pull/25110#discussion_r2672401215


##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java:
##########
@@ -1243,14 +1243,17 @@ public boolean hasMoreEntries() {
 
     @Override
     public long getNumberOfEntries() {
-        if (readPosition.compareTo(ledger.getLastPosition().getNext()) > 0) {
+        Position readPos = readPosition;
+        Position lastPosition = ledger.getLastPosition();
+        Position nextPosition = lastPosition.getNext();

Review Comment:
   Oh sorry, I misunderstood it before. I've thought `lastPosition` and 
`nextPosition` are computed individually, but `nextPosition` is computed based 
on `lastPosition`, so there should be no issue here. 



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