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

Upgrade xxhash, add Hash128 #8634

Closed
wants to merge 5 commits into from
Closed

Conversation

pdillinger
Copy link
Contributor

@pdillinger pdillinger commented Aug 6, 2021

Summary: With expected use for a 128-bit hash, xxhash library is
upgraded to current dev (2c611a76f914828bed675f0f342d6c4199ffee1e)
as of Aug 6 so that we can use production version of XXH3_128bits
as new Hash128 function (added in hash128.h).

To make this work, however, we have to carve out the "preview" version
of XXH3 that is used in new SST Bloom and Ribbon filters, since that
will not get maintenance in xxhash releases. I have consolidated all the
relevant code into xxph3.h and made it "inline only" (no .cc file). The
working name for this hash function is changed from XXH3p to XXPH3
(XX Preview Hash) because the latter is easier to get working with no
symbol name conflicts between the headers.

Test Plan: no expected change in existing functionality. For Hash128,
added some unit tests based on those for Hash64 to ensure some basic
properties and that the values do not change accidentally.

Summary: With expected use for a 128-bit hash, xxhash library is
upgraded to current dev (2c611a76f914828bed675f0f342d6c4199ffee1e)
as of Aug 6 so that we can use production version of XXH3_128bits.

To make this work, however, we have to carve out the "preview" version
of XXH3 that is used in new SST Bloom and Ribbon filters, since that
will not get maintenance in xxhash releases. I have consolidated all the
relevant code into xxh3p.h and made it "inline only" (no .cc file).

Test Plan: no expected change in functionality (existing tests)
@pdillinger
Copy link
Contributor Author

Argh, forgot about unity build

@pdillinger
Copy link
Contributor Author

(format check expected to fail because of outside source code)

@pdillinger pdillinger changed the title Upgrade xxhash and separate out xxh3p Upgrade xxhash and separate out preview XXH3 Aug 6, 2021
@facebook-github-bot
Copy link
Contributor

@pdillinger has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@pdillinger has updated the pull request. You must reimport the pull request before landing.

@pdillinger pdillinger changed the title Upgrade xxhash and separate out preview XXH3 Upgrade xxhash, add Hash128 Aug 11, 2021
@facebook-github-bot
Copy link
Contributor

@pdillinger has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

pdillinger added a commit to pdillinger/xxHash that referenced this pull request Aug 11, 2021
Summary: UBSAN run reported on using seed 1<<63 with XXH3 because of
`-(xxh_i64)seed64` overflow. Seen in CI for
facebook/rocksdb#8634

To fix, negate as unsigned (well defined under/overflow) and then cast
to signed.

Test Plan: same patch fixes the report in RocksDB
@facebook-github-bot
Copy link
Contributor

@pdillinger has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@pdillinger has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link
Contributor

@zhichao-cao zhichao-cao left a comment

Choose a reason for hiding this comment

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

LGTM, should we mention it in the HISTORY.md?

@pdillinger
Copy link
Contributor Author

LGTM, should we mention it in the HISTORY.md?

There should be no user-visible change. :)

@facebook-github-bot
Copy link
Contributor

@pdillinger has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@pdillinger has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@pdillinger merged this pull request in 22161b7.

AralRocais added a commit to AralRocais/xxHash that referenced this pull request Nov 3, 2022
Summary: UBSAN run reported on using seed 1<<63 with XXH3 because of
`-(xxh_i64)seed64` overflow. Seen in CI for
facebook/rocksdb#8634

To fix, negate as unsigned (well defined under/overflow) and then cast
to signed.

Test Plan: same patch fixes the report in RocksDB
yoori pushed a commit to yoori/rocksdb that referenced this pull request Nov 26, 2023
Summary:
With expected use for a 128-bit hash, xxhash library is
upgraded to current dev (2c611a76f914828bed675f0f342d6c4199ffee1e)
as of Aug 6 so that we can use production version of XXH3_128bits
as new Hash128 function (added in hash128.h).

To make this work, however, we have to carve out the "preview" version
of XXH3 that is used in new SST Bloom and Ribbon filters, since that
will not get maintenance in xxhash releases. I have consolidated all the
relevant code into xxph3.h and made it "inline only" (no .cc file). The
working name for this hash function is changed from XXH3p to XXPH3
(XX Preview Hash) because the latter is easier to get working with no
symbol name conflicts between the headers.

Pull Request resolved: facebook/rocksdb#8634

Test Plan:
no expected change in existing functionality. For Hash128,
added some unit tests based on those for Hash64 to ensure some basic
properties and that the values do not change accidentally.

Reviewed By: zhichao-cao

Differential Revision: D30173490

Pulled By: pdillinger

fbshipit-source-id: 06aa542a7a28b353bc2c865b9b2f8bdfe44158e4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants