Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(bloom): BloomBitsPerKey does not depend on number of keys #4

Merged
merged 2 commits into from
Mar 29, 2022

Conversation

SaveTheRbtz
Copy link
Contributor

@SaveTheRbtz SaveTheRbtz commented Mar 29, 2022

During the bits per key (m/n) calculation we first multiply the result by numEntries to get the size of the bloom filter (m), and then divide by numEntries to get the m/n. Also for some reason, as was mentioned in #1763, current implementation underestimates the result by 30% because of erroneous multiplication by Ln2.

Wikipedia suggests that bits per key calculation can be simplified to:

While here also fix edgecases for very small and large ε to protect against misuse and added tests.

This is a copy of: dgraph-io/badger#1773


This change is Reviewable

@CLAassistant
Copy link

CLAassistant commented Mar 29, 2022

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@manishrjain manishrjain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm: Makes sense. Thanks for the PR!

Reviewed 3 of 3 files at r1, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @SaveTheRbtz)

@manishrjain manishrjain merged commit 2e285f8 into outcaste-io:main Mar 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants