Skip to content

[lib] Always load the dictionary in one go#2607

Merged
terrelln merged 2 commits intofacebook:devfrom
terrelln:deterministic-dict
May 5, 2021
Merged

[lib] Always load the dictionary in one go#2607
terrelln merged 2 commits intofacebook:devfrom
terrelln:deterministic-dict

Conversation

@terrelln
Copy link
Contributor

@terrelln terrelln commented May 4, 2021

Dictionaries larger than ZSTD_CHUNKSIZE_MAX used to have to be loaded
in multiple segments. Instead, when we detect large dictionaries, ensure
that we reset the context's indicies. Then, for dictionaries larger than
ZSTD_CURRENT_MAX - 1, only load the suffix of the dictionary. Finally,
enable DDS for large dictionaries, since we no longer load in multiple
segments.

This simplifes the dictionary loading code, and reduces opportunities
for non-determinism to slip in.

I've manually tested with large dictionaries, and added one large
--patch-from test. This gives us some coverage of large
dictionaries, and we should have should have good coverage of
normal sized dictionaries from our fuzzers/tests.

@terrelln terrelln force-pushed the deterministic-dict branch 3 times, most recently from 359da5e to 94db439 Compare May 4, 2021 23:40
Dictionaries larger than `ZSTD_CHUNKSIZE_MAX` used to have to be loaded
in multiple segments. Instead, when we detect large dictionaries, ensure
that we reset the context's indicies. Then, for dictionaries larger than
`ZSTD_CURRENT_MAX - 1`, only load the suffix of the dictionary. Finally,
enable DDS for large dictionaries, since we no longer load in multiple
segments.

This simplifes the dictionary loading code, and reduces opportunities
for non-determinism to slip in.
@terrelln terrelln force-pushed the deterministic-dict branch from d71ca48 to 0b88c25 Compare May 5, 2021 00:26
Dictionary size must be > `ZSTD_CHUNKSIZE_MAX`.
@terrelln terrelln merged commit 10e5513 into facebook:dev May 5, 2021
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