apache / apache/pulsar

[Bug] ConcurrentBitmapSortedLongPairSet doesn't support pairs where the right value of the pair is larger than Integer.MAX_VALUE

Open
#23,877 1 comment 0 reactions 0 assignees View on GitHub
type/bug
Dominant language
Java
Stars
15.3k
Forks
3.8k
Avg merge
1d 14h
Merged PRs (30d)
160

Description

### Search before asking

- [x] I searched in the [issues](https://github.com/apache/pulsar/issues) and found nothing similar.

### Read release policy

- [x] I understand that unsupported versions don't get bug fixes. I will attempt to reproduce the issue on a supported version of Pulsar client and Pulsar broker.

### Version

any released version

### Minimal reproduce step

ConcurrentBitmapSortedLongPairSet uses internally RoaringBitmap which supports values up to 2^32.
Since ConcurrentBitmapSortedLongPairSet uses `Iterator` in the implementation, it can only support values up to 2^31-1 (`Integer.MAX_INTEGER`).

### What did you expect to see?

Since the class interface and name is about supporting a Long pair, it should support long values for both right and left values of the pair.

### What did you see instead?

Long value is not supported for the right value of the pair.

### Anything else?

A possible solution would be to replace org.roaringbitmap.RoaringBitmap with org.roaringbitmap.longlong.Roaring64Bitmap.
However, Roaring64Bitmap interface is slightly different and would result in other changes.

An alternative mitigation is to improve ConcurrentBitmapSortedLongPairSet to support values up to 2^32. That is implemented in PR #23878.

### Are you willing to submit a PR?

- [ ] I'm willing to submit a PR!

Contributor guide

Open the contributing guide

Research direction

Start at ConcurrentBitmapSortedLongPairSet and inspect how its Integer iterator and RoaringBitmap represent the right value of a pair. Reproduce the failure with a right value larger than Integer.MAX_VALUE, then compare the expected behavior with the mitigation described in PR #23878. Done means long pairs work for values supported by the class interface without breaking existing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
distributed-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.