lhotari commented on code in PR #24089:
URL: https://github.com/apache/pulsar/pull/24089#discussion_r2003390127


##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java:
##########
@@ -3826,9 +3826,19 @@ static long estimateEntryCountBySize(long bytesSize, 
Position readPosition, Mana
         long result = 0;
         long remainingBytesSize = bytesSize;
 
+        Position previousPosToRead = null;
         while (remainingBytesSize > 0) {
-            // Last ledger.
-            if (posToRead.getLedgerId() == ml.getCurrentLedger().getId()) {

Review Comment:
   I have moved the estimation logic to a separate class so that it's easier to 
unit test the logic without mocking. It makes it easier to make it more 
understandable when this logic isn't part of the ManagedCursorImpl class. We 
have too large classes already and splitting into smaller classes would be a 
desirable direction.
   Please review @poorbarcode and @BewareMyPower 



-- 
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: commits-unsubscr...@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to