Skip to content

Commit

Permalink
Revert "[improve][broker] Optimize ConcurrentOpenLongPairRangeSet b…
Browse files Browse the repository at this point in the history
…y RoaringBitmap (apache#22908)"

This reverts commit f99040d.

(cherry picked from commit 266f98c)
  • Loading branch information
lhotari authored and nikhil-ctds committed Jun 27, 2024
1 parent 5902fff commit f800bcb
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 455 deletions.
3 changes: 2 additions & 1 deletion distribution/server/src/assemble/LICENSE.bin.txt
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,8 @@ The Apache Software License, Version 2.0
* RxJava
- io.reactivex.rxjava3-rxjava-3.0.1.jar
* RoaringBitmap
- org.roaringbitmap-RoaringBitmap-1.1.0.jar
- org.roaringbitmap-RoaringBitmap-0.9.44.jar
- org.roaringbitmap-shims-0.9.44.jar

BSD 3-clause "New" or "Revised" License
* Google auth library
Expand Down
2 changes: 0 additions & 2 deletions distribution/shell/src/assemble/LICENSE.bin.txt
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,6 @@ The Apache Software License, Version 2.0
- simpleclient_tracer_common-0.16.0.jar
- simpleclient_tracer_otel-0.16.0.jar
- simpleclient_tracer_otel_agent-0.16.0.jar
* RoaringBitmap
- RoaringBitmap-1.1.0.jar
* Log4J
- log4j-api-2.18.0.jar
- log4j-core-2.18.0.jar
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ flexible messaging model and an intuitive client API.</description>
<j2objc-annotations.version>1.3</j2objc-annotations.version>
<lightproto-maven-plugin.version>0.4</lightproto-maven-plugin.version>
<dependency-check-maven.version>9.1.0</dependency-check-maven.version>
<roaringbitmap.version>1.1.0</roaringbitmap.version>
<roaringbitmap.version>0.9.44</roaringbitmap.version>
<extra-enforcer-rules.version>1.6.1</extra-enforcer-rules.version>
<oshi.version>6.4.0</oshi.version>
</properties>
Expand Down
5 changes: 0 additions & 5 deletions pulsar-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,6 @@
<artifactId>awaitility</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.roaringbitmap</groupId>
<artifactId>RoaringBitmap</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import java.util.concurrent.ConcurrentSkipListMap;
import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.commons.lang.mutable.MutableInt;
import org.roaringbitmap.RoaringBitSet;

/**
* A Concurrent set comprising zero or more ranges of type {@link LongPair}. This can be alternative of
Expand All @@ -45,7 +44,7 @@
public class ConcurrentOpenLongPairRangeSet<T extends Comparable<T>> implements LongPairRangeSet<T> {

protected final NavigableMap<Long, BitSet> rangeBitSetMap = new ConcurrentSkipListMap<>();
private final boolean threadSafe;
private boolean threadSafe = true;
private final int bitSetSize;
private final LongPairConsumer<T> consumer;

Expand Down Expand Up @@ -96,7 +95,9 @@ public void addOpenClosed(long lowerKey, long lowerValueOpen, long upperKey, lon
// (2) set 0th-index to upper-index in upperRange.getKey()
if (isValid(upperKey, upperValue)) {
BitSet rangeBitSet = rangeBitSetMap.computeIfAbsent(upperKey, (key) -> createNewBitSet());
rangeBitSet.set(0, (int) upperValue + 1);
if (rangeBitSet != null) {
rangeBitSet.set(0, (int) upperValue + 1);
}
}
// No-op if values are not valid eg: if lower == LongPair.earliest or upper == LongPair.latest then nothing
// to set
Expand Down Expand Up @@ -413,6 +414,7 @@ private int getSafeEntry(long value) {
}

private BitSet createNewBitSet() {
return this.threadSafe ? new ConcurrentRoaringBitSet() : new RoaringBitSet();
return this.threadSafe ? new ConcurrentBitSet(bitSetSize) : new BitSet(bitSetSize);
}
}

}
Loading

0 comments on commit f800bcb

Please sign in to comment.