You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/09/05 12:53:39 UTC

[GitHub] [pulsar] lhotari commented on a diff in pull request #17465: [improve][broker] Improve cursor.getNumberOfEntries if isUnackedRangesOpenCacheSetEnabled=true

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


##########
pulsar-common/src/main/java/org/apache/pulsar/common/util/collections/ConcurrentOpenLongPairRangeSet.java:
##########
@@ -242,6 +242,27 @@ public Range<T> lastRange() {
         return Range.openClosed(consumer.apply(lastSet.getKey(), lower), consumer.apply(lastSet.getKey(), upper));
     }
 
+    @Override
+    public int cardinality(long lowerKey, long lowerValue, long upperKey, long upperValue) {
+        NavigableMap<Long, BitSet> subMap = rangeBitSetMap.subMap(lowerKey, true, upperKey, true);
+        MutableInt v = new MutableInt(0);
+        subMap.forEach((ledgerId, bitset) -> {

Review Comment:
   Since the class `ConcurrentOpenLongPairRangeSet` isn't specific to ledgers, would it make sense to avoid using `ledgerId` as the variable name?



-- 
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-unsubscribe@pulsar.apache.org

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