lhotari opened a new pull request, #4067:
URL: https://github.com/apache/bookkeeper/pull/4067
Descriptions of the changes in this PR:
### Motivation
- Fix a bug in ConcurrentLongLongPairHashMap, ConcurrentLongPairSet and
ConcurrentOpenHashMap where the hash bucket's storage index was incorrectly
calculated.
- the impact of the bug has been that the implementations have been rather
unoptimal because of of frequent collisions in storing the item to the
underlying array. Essentially the hash bucket algorithm hasn't been properly
used.
- Fix a bug in `signSafeMod` function which is duplicated in all classes.
The buggy implementation didn't return correct results for negative input
values.
### Changes
- rename `bucket` to `bucketIndex` to indicate that it's the bucket index in
the storage array that needs to be calculated.
- calculate bucketIndex by multiplying the hash bucket by the item size (4
or 2).
- fix the `signSafeMod` function which wasn't sign safe at all. Negative
input values produced invalid results. Currently the logic is duplicated in all
classes.
### Additional context
See Pulsar bugs https://github.com/apache/pulsar/issues/21106 and
https://github.com/apache/pulsar/issues/21108 in similar classes that are
duplicated in the Pulsar code base and the fix PR
https://github.com/apache/pulsar/issues/21107.
--
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]