codelipenghui opened a new pull request, #17453: URL: https://github.com/apache/pulsar/pull/17453
Fixes #17451 ### Motivation Improve the `ManagedCursorImpl.getNumberOfEntries()` if `isUnackedRangesOpenCacheSetEnabled=true`. Since the `ConcurrentOpenLongPairRangeSet` has the ability to get the acked count for each Ledger, the `ManagedCursorImpl` can avoid iterating each range to calculate the acked count. ### Modifications Make the `ConcurrentOpenLongPairRangeSet` able to get acked count for each ledger. Make the `ManagedCursorImpl` get the acked count directly from the `ConcurrentOpenLongPairRangeSet` There is a case that will miss ledger ID in `ConcurrentOpenLongPairRangeSet`: https://github.com/apache/pulsar/blob/bd012adc05333e393bf4f2fa4fae178a228726a8/pulsar-common/src/main/java/org/apache/pulsar/common/util/collections/ConcurrentOpenLongPairRangeSet.java#L84-L94 This means all the messages of this ledger have been acked. So the `ManagedCursorImpl` need to handle this case to remove the acked count for `getNumberOfEntries()` ### Verifying this change Unit test for the new method introduced in `ConcurrentOpenLongPairRangeSet` The `getNumberOfEntries()` change is already covered by the existing test ### Documentation Check the box below or label this PR directly. Need to update docs? - [x] `doc-not-needed` (Just an improvement for the presented implementation) -- 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]
