You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by yu...@apache.org on 2023/05/08 08:31:13 UTC

[pulsar] branch branch-2.10 updated: [fix][broker] Fix `RoaringBitmap.contains` can't check value 65535 (#20176)

This is an automated email from the ASF dual-hosted git repository.

yubiao pushed a commit to branch branch-2.10
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/branch-2.10 by this push:
     new edc3a6fb06b [fix][broker] Fix `RoaringBitmap.contains` can't check value 65535 (#20176)
edc3a6fb06b is described below

commit edc3a6fb06bc009401b2b3181e45dfd44af859c2
Author: Cong Zhao <zh...@apache.org>
AuthorDate: Mon May 8 16:23:30 2023 +0800

    [fix][broker] Fix `RoaringBitmap.contains` can't check value 65535 (#20176)
    
    (cherry picked from commit 2f9f5df4a2b4d33ba4a0c7b3ca19267faa50d399)
---
 distribution/server/src/assemble/LICENSE.bin.txt   |  2 +-
 pom.xml                                            |  2 +-
 .../java/org/apache/pulsar/RoaringbitmapTest.java  | 56 ++++++++++++++++++++++
 3 files changed, 58 insertions(+), 2 deletions(-)

diff --git a/distribution/server/src/assemble/LICENSE.bin.txt b/distribution/server/src/assemble/LICENSE.bin.txt
index c36f823e376..138e54fc4a3 100644
--- a/distribution/server/src/assemble/LICENSE.bin.txt
+++ b/distribution/server/src/assemble/LICENSE.bin.txt
@@ -539,7 +539,7 @@ The Apache Software License, Version 2.0
   * IPAddress
     - com.github.seancfoley-ipaddress-5.3.3.jar
   * RoaringBitmap
-    - org.roaringbitmap-RoaringBitmap-0.9.15.jar
+    - org.roaringbitmap-RoaringBitmap-0.9.44.jar
 
 BSD 3-clause "New" or "Revised" License
  * Google auth library
diff --git a/pom.xml b/pom.xml
index 72626913b17..1febc3a06e7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -266,7 +266,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>8.0.1</dependency-check-maven.version>
-    <roaringbitmap.version>0.9.15</roaringbitmap.version>
+    <roaringbitmap.version>0.9.44</roaringbitmap.version>
 
     <!-- Used to configure rename.netty.native. Libs -->
     <rename.netty.native.libs>rename-netty-native-libs.sh</rename.netty.native.libs>
diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/RoaringbitmapTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/RoaringbitmapTest.java
new file mode 100644
index 00000000000..477e7413ef9
--- /dev/null
+++ b/pulsar-broker/src/test/java/org/apache/pulsar/RoaringbitmapTest.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pulsar;
+
+import static org.testng.Assert.assertTrue;
+import org.roaringbitmap.RoaringBitmap;
+import org.testng.annotations.Test;
+
+public class RoaringbitmapTest {
+
+    @Test
+    public void testRoaringBitmapContains() {
+        RoaringBitmap roaringBitmap = new RoaringBitmap();
+        for (long i = 1; i <= 100_000; i++) {
+            roaringBitmap.add(i, i + 1);
+        }
+
+        for (long i = 1; i <= 100_000; i++) {
+            assertTrue(roaringBitmap.contains(i, i + 1));
+        }
+
+        RoaringBitmap roaringBitmap2 = new RoaringBitmap();
+        for (long i = 1; i <= 1000_000; i++) {
+            roaringBitmap2.add(i, i + 1);
+        }
+
+        for (long i = 1; i <= 1000_000; i++) {
+            assertTrue(roaringBitmap2.contains(i, i + 1));
+        }
+
+        RoaringBitmap roaringBitmap3 = new RoaringBitmap();
+        for (long i = 1; i <= 10_000_000; i++) {
+            roaringBitmap3.add(i, i + 1);
+        }
+
+        for (long i = 1; i <= 10_000_000; i++) {
+            assertTrue(roaringBitmap3.contains(i, i + 1));
+        }
+    }
+}