Change lzf to handle values larger than UINT32_MAX#9776
Merged
oranagra merged 3 commits intoredis:unstablefrom Nov 16, 2021
Merged
Change lzf to handle values larger than UINT32_MAX#9776oranagra merged 3 commits intoredis:unstablefrom
oranagra merged 3 commits intoredis:unstablefrom
Conversation
oranagra
reviewed
Nov 14, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe of feature
Redis supports inserting data over 4GB into string (and recently for lists too, see #9357), But LZF compression used in RDB files (see
rdbcompressionconfig), and in quicklist (seelist-compress-depthconfig) does not support compress/decompress data over UINT32_MAX, which will result in corrupting the rdb after compression.Internal changes
unsigned intparameter oflzf_compress/lzf_decompresstosize_t.lzf_compressinvolving offsets and lengths tosize_t.When LZF_USE_OFFSETS is 1, lzf store offset into
LZF_HSLOT(32bit).Even in 64-bit,
LZF_USE_OFFSETSdefaults to 1, because lzf assumes that it only compresses and decompresses data smaller than UINT32_MAX.But now we need to make lzf support 64-bit, turning on
LZF_USE_OFFSETSwill make it impossible to store 64-bitoffsets or pointers.
BTW, disable LZF_USE_OFFSETS also brings a few performance improvements.
Test
Implements #9732.