nodece opened a new pull request, #26127:
URL: https://github.com/apache/pulsar/pull/26127
Fixes #26120
### Motivation
`RangeSetWrapper` is an unnecessarily generic abstraction in the Pulsar
codebase. All production usages are `RangeSetWrapper<Position>` in
`ManagedCursorImpl` for tracking individually deleted messages.
The current implementation also maintains two selectable backends:
`OpenLongPairRangeSet` and `DefaultRangeSet`, controlled by
`unackedRangesOpenCacheSetEnabled`. This choice no longer provides
practical value and adds complexity to the code path.
This refactoring introduces a Position-specific range set implementation
to simplify the code and provide a cleaner foundation for future work on
individual acknowledgment persistence, including more space-efficient
serialization and PIP-81 style segmented cursor state persistence.
### Modifications
- Add `PositionRangeSet` as a replacement for `RangeSetWrapper`.
- Remove unnecessary generic type abstraction.
- Specialize the implementation for `Position` only.
- Use `TreeMap<Long, RoaringBitSet>` internally, where each bitmap tracks
entryIds within a ledger.
- Keep the implementation non-thread-safe and rely on the existing
cursor locking contract from callers.
- Migrate `ManagedCursorImpl` individual deleted message tracking from
`RangeSetWrapper<Position>` to `PositionRangeSet`.
- Remove the runtime choice between `OpenLongPairRangeSet` and
`DefaultRangeSet`.
- Deprecate `unackedRangesOpenCacheSetEnabled` configuration options.
They are kept as no-ops for compatibility with existing 4.x configuration
files.
- Preserve existing cursor state wire format compatibility by continuing
to use the existing `BitSet.toLongArray()` / `BitSet.valueOf()` format.
RoaringBitmap native serialization is intentionally not introduced in
this change.
- Add `PositionRangeSetTest`,
`PositionRangeSetCompatibilityTest`, and
`PositionRangeSetBenchmark`.
- Mark `ManagedCursorImpl#recoverIndividualDeletedMessages` as
`@VisibleForTesting` to simplify test usage.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]