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

Do better than "Too many iterations. Are all your keys unique?" #31

Open
lemire opened this issue Jan 5, 2023 · 0 comments
Open

Do better than "Too many iterations. Are all your keys unique?" #31

lemire opened this issue Jan 5, 2023 · 0 comments

Comments

@lemire
Copy link

lemire commented Jan 5, 2023

Instead of failing with "Too many iterations. Are all your keys unique?", I recommend filling in the fingerprint buffer with 1s.

Example in Go:

		if iterations > MaxIterations {
			// The probability of this happening is lower than the
			// the cosmic-ray probability (i.e., a cosmic ray corrupts your system),
			// but if it happens, we just fill the fingerprint with ones which
			// will flag all possible keys as 'possible', ensuring a correct result.
			for i := 0; i < len(filter.Fingerprints); i++ {
				filter.Fingerprints[i] = ^uint8(0)
			}
			return filter, nil
		}

Reference:
https://github.com/FastFilter/xorfilter/blob/6e1eda073dd4927a1c807e2cc47e4a66b56ad7a6/fusefilter.go#L104-L113

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

No branches or pull requests

1 participant