gaoran10 commented on code in PR #24055: URL: https://github.com/apache/pulsar/pull/24055#discussion_r1983064036
########## managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java: ########## @@ -3811,9 +3811,11 @@ public int applyMaxSizeCap(int maxEntries, long maxSizeBytes) { if (maxSizeBytes == NO_MAX_SIZE_LIMIT) { return maxEntries; } - int maxEntriesBasedOnSize = - Long.valueOf(estimateEntryCountBySize(maxSizeBytes, readPosition, ledger)).intValue(); - return Math.min(maxEntriesBasedOnSize, maxEntries); + long estimatedEntryCount = estimateEntryCountBySize(maxSizeBytes, readPosition, ledger); + if (estimatedEntryCount > Integer.MAX_VALUE) { Review Comment: The estimateEntryCountBySize method returns this `return Math.max(result, 1);`, the value shouldn't be less than 1. -- 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