You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "coderzc (via GitHub)" <gi...@apache.org> on 2023/04/25 03:06:48 UTC

[GitHub] [pulsar] coderzc opened a new pull request, #20176: [fix][broker] Fix RoaringBitmap contains can't check value 65535

coderzc opened a new pull request, #20176:
URL: https://github.com/apache/pulsar/pull/20176

   Master Issue: #xyz
   
   https://github.com/RoaringBitmap/RoaringBitmap/issues/623
   
   PIP: #xyz 
   
   <!-- Details of when a PIP is required and how the PIP process work, please see: https://github.com/apache/pulsar/blob/master/wiki/proposals/PIP.md -->
   
   ### Motivation
   
   Using `contains(final int x)` instead of `contains(long minimum, long supremum)`.
   
   ### Modifications
   
   <!-- Describe the modifications you've done. -->
   
   ### Verifying this change
   
   - [x] Make sure that the change passes the CI checks.
   
   *(Please pick either of the following options)*
   
   This change is a trivial rework / code cleanup without any test coverage.
   
   *(or)*
   
   This change is already covered by existing tests, such as *(please describe tests)*.
   
   *(or)*
   
   This change added tests and can be verified as follows:
   
   *(example:)*
     - *Added integration tests for end-to-end deployment with large payloads (10MB)*
     - *Extended integration test for recovery after broker failure*
   
   ### Does this pull request potentially affect one of the following parts:
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   *If the box was checked, please highlight the changes*
   
   - [ ] Dependencies (add or upgrade a dependency)
   - [ ] The public API
   - [ ] The schema
   - [ ] The default values of configurations
   - [ ] The threading model
   - [ ] The binary protocol
   - [ ] The REST endpoints
   - [ ] The admin CLI options
   - [ ] The metrics
   - [ ] Anything that affects deployment
   
   ### Documentation
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   - [ ] `doc` <!-- Your PR contains doc changes. -->
   - [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
   - [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
   - [ ] `doc-complete` <!-- Docs have been already added -->
   
   ### Matching PR in forked repository
   
   PR in forked repository: <!-- ENTER URL HERE -->
   
   <!--
   After opening this PR, the build in apache/pulsar will fail and instructions will
   be provided for opening a PR in the PR author's forked repository.
   
   apache/pulsar pull requests should be first tested in your own fork since the 
   apache/pulsar CI based on GitHub Actions has constrained resources and quota.
   GitHub Actions provides separate quota for pull requests that are executed in 
   a forked repository.
   
   The tests will be run in the forked repository until all PR review comments have
   been handled, the tests pass and the PR is approved by a reviewer.
   -->
   


-- 
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


[GitHub] [pulsar] coderzc closed pull request #20176: [fix][broker] Fix `RoaringBitmap.contains` can't check value 65535

Posted by "coderzc (via GitHub)" <gi...@apache.org>.
coderzc closed pull request #20176: [fix][broker] Fix `RoaringBitmap.contains` can't check value 65535
URL: https://github.com/apache/pulsar/pull/20176


-- 
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


[GitHub] [pulsar] tisonkun commented on a diff in pull request #20176: [fix][broker] Fix `RoaringBitmap.contains` can't check value 65535

Posted by "tisonkun (via GitHub)" <gi...@apache.org>.
tisonkun commented on code in PR #20176:
URL: https://github.com/apache/pulsar/pull/20176#discussion_r1187167921


##########
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));

Review Comment:
   nit: add description so that we not which `i` fails instead of generic:
   
   ```
   java.lang.AssertionError:
   Expected :true
   Actual   :false
   ```



##########
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));

Review Comment:
   nit: add description so that we know which `i` fails instead of generic:
   
   ```
   java.lang.AssertionError:
   Expected :true
   Actual   :false
   ```



-- 
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


[GitHub] [pulsar] codecov-commenter commented on pull request #20176: [fix][broker] Fix `RoaringBitmap.contains` can't check value 65535

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #20176:
URL: https://github.com/apache/pulsar/pull/20176#issuecomment-1537923504

   ## [Codecov](https://app.codecov.io/gh/apache/pulsar/pull/20176?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#20176](https://app.codecov.io/gh/apache/pulsar/pull/20176?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (e28b882) into [master](https://app.codecov.io/gh/apache/pulsar/commit/35e9897742b7db4bd29349940075a819b2ad6999?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (35e9897) will **increase** coverage by `35.24%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://app.codecov.io/gh/apache/pulsar/pull/20176/graphs/tree.svg?width=650&height=150&src=pr&token=acYqCpsK9J&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://app.codecov.io/gh/apache/pulsar/pull/20176?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@              Coverage Diff              @@
   ##             master   #20176       +/-   ##
   =============================================
   + Coverage     37.64%   72.89%   +35.24%     
   - Complexity    12522    31963    +19441     
   =============================================
     Files          1691     1868      +177     
     Lines        128933   138594     +9661     
     Branches      14061    15246     +1185     
   =============================================
   + Hits          48540   101026    +52486     
   + Misses        74070    29531    -44539     
   - Partials       6323     8037     +1714     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | inttests | `24.14% <ø> (-0.02%)` | :arrow_down: |
   | systests | `24.77% <ø> (-0.10%)` | :arrow_down: |
   | unittests | `72.20% <ø> (+39.09%)` | :arrow_up: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   [see 1431 files with indirect coverage changes](https://app.codecov.io/gh/apache/pulsar/pull/20176/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   


-- 
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


[GitHub] [pulsar] tisonkun merged pull request #20176: [fix][broker] Fix `RoaringBitmap.contains` can't check value 65535

Posted by "tisonkun (via GitHub)" <gi...@apache.org>.
tisonkun merged PR #20176:
URL: https://github.com/apache/pulsar/pull/20176


-- 
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


[GitHub] [pulsar] michaeljmarshall commented on pull request #20176: [fix][broker] Fix `RoaringBitmap.contains` can't check value 65535

Posted by "michaeljmarshall (via GitHub)" <gi...@apache.org>.
michaeljmarshall commented on PR #20176:
URL: https://github.com/apache/pulsar/pull/20176#issuecomment-1610271570

   As discussed on the mailing list https://lists.apache.org/thread/w4jzk27qhtosgsz7l9bmhf1t7o9mxjhp, there is no plan to release 2.9.6, so I am going to remove the release/2.9.6 label


-- 
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


[GitHub] [pulsar] lhotari commented on pull request #20176: [fix][broker] Fix `RoaringBitmap.contains` can't check value 65535

Posted by "lhotari (via GitHub)" <gi...@apache.org>.
lhotari commented on PR #20176:
URL: https://github.com/apache/pulsar/pull/20176#issuecomment-1550784506

   @coderzc Please update the PR description with the impact of this bug. 
   
   Here's my version of describing the impact:
   MessageRedeliveryController uses the RoaringBitmap under the covers to track entryIds to redeliver.
   The bug in RoaringBitmap (that has now been fixed) caused at least the case that the bit index 65535 couldn't be set.
   The consequence of this would be that a message that should be redelivered doesn't get delivered and this could get Key_Shared subscriptions to get stuck. This could impact also other subscription types and cause a backlog to build up.
   This bug was introduced in 2.10.2 with #17804 since that's when MessageRedeliveryController switched to use the RoaringBitmap based datastructure.
   
   @codelipenghui @coderzc Is this the correct interpretation?
   
   


-- 
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


[GitHub] [pulsar] codelipenghui commented on pull request #20176: [fix][broker] Fix `RoaringBitmap.contains` can't check value 65535

Posted by "codelipenghui (via GitHub)" <gi...@apache.org>.
codelipenghui commented on PR #20176:
URL: https://github.com/apache/pulsar/pull/20176#issuecomment-1550787809

   @lhotari Yes, looks good to me. Thanks.


-- 
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


[GitHub] [pulsar] codelipenghui commented on pull request #20176: [fix][broker] Fix `RoaringBitmap.contains` can't check value 65535

Posted by "codelipenghui (via GitHub)" <gi...@apache.org>.
codelipenghui commented on PR #20176:
URL: https://github.com/apache/pulsar/pull/20176#issuecomment-1521184920

   Interesting, ConcurrentBitmapSortedLongPairSet also used the same method.
   


-- 
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


[GitHub] [pulsar] coderzc commented on pull request #20176: [fix][broker] Fix `RoaringBitmap.contains` can't check value 65535

Posted by "coderzc (via GitHub)" <gi...@apache.org>.
coderzc commented on PR #20176:
URL: https://github.com/apache/pulsar/pull/20176#issuecomment-1521190130

   > RoaringBitmap/RoaringBitmap#623
   
   Yeah, I'm not sure if our usage is wrong


-- 
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


[GitHub] [pulsar] tisonkun commented on a diff in pull request #20176: [fix][broker] Fix `RoaringBitmap.contains` can't check value 65535

Posted by "tisonkun (via GitHub)" <gi...@apache.org>.
tisonkun commented on code in PR #20176:
URL: https://github.com/apache/pulsar/pull/20176#discussion_r1187167921


##########
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));

Review Comment:
   outstanding improvement: add description so that we not which `i` fails instead of generic:
   
   ```
   java.lang.AssertionError:
   Expected :true
   Actual   :false
   ```



-- 
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


[GitHub] [pulsar] tisonkun commented on pull request #20176: [fix][broker] Fix `RoaringBitmap.contains` can't check value 65535

Posted by "tisonkun (via GitHub)" <gi...@apache.org>.
tisonkun commented on PR #20176:
URL: https://github.com/apache/pulsar/pull/20176#issuecomment-1537955265

   Merging...


-- 
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