Ensure correct compression for a node that was too small to compress but grows larger #13121
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.
Following #12568
Discussion in #12568 (comment)
When a node needs to be compressed but is too small to be compressed, if this node becomes big enough to be compressed, it should be correctly compressed.
Reproduction:
When we use
quicklistDecompressNodeForUse()
to decompress the node mentioned above,recompress
will be 0, thus when quicklistRecompressOnly() is used to recompress this node, it will not be recompressed again anyway.
Solution:
Enable the
attempted_compress
feature, no longer used only in REDIS_TEST.When it is true, it means that the node needs to be compressed but failed.
When a node is compressed but fails, set
attempted_compress
to 1.When using quicklistDecompressNodeForUse() and
attempted_compress
is 1, we will set recompress to 1, ensuring that when calling quicklistRecompressOnly(), this node can be correctly compressed.