Skip to content

Fix crash due to merge of quicklist node introduced by #12955#13040

Merged
oranagra merged 3 commits intoredis:unstablefrom
sundb:fix_quicklist_merge
Feb 8, 2024
Merged

Fix crash due to merge of quicklist node introduced by #12955#13040
oranagra merged 3 commits intoredis:unstablefrom
sundb:fix_quicklist_merge

Conversation

@sundb
Copy link
Collaborator

@sundb sundb commented Feb 8, 2024

Fix two crash introducted by #12955

When a quicklist node can't be inserted and split, we eventually merge the current node with its neighboring
nodes after inserting, and compress the current node and its siblings.

  1. When the current node is merged with another node, the current node may become invalid and can no longer be used.

    Solution: let _quicklistMergeNodes() return the merged nodes.

  2. If the current node is a LZF quicklist node, its recompress will be 1. If the split node can be merged with a sibling node to become head or tail, recompress may cause the head and tail to be compressed, which is not allowed.

    Solution: always recompress to 0 after merging.

@oranagra oranagra merged commit 1e8dc1d into redis:unstable Feb 8, 2024
@sundb sundb deleted the fix_quicklist_merge branch February 8, 2024 12:44
roggervalf pushed a commit to roggervalf/redis that referenced this pull request Feb 11, 2024
…edis#13040)

Fix two crash introducted by redis#12955

When a quicklist node can't be inserted and split, we eventually merge
the current node with its neighboring
nodes after inserting, and compress the current node and its siblings.

1. When the current node is merged with another node, the current node
may become invalid and can no longer be used.

   Solution: let `_quicklistMergeNodes()` return the merged nodes.

3. If the current node is a LZF quicklist node, its recompress will be
1. If the split node can be merged with a sibling node to become head or
tail, recompress may cause the head and tail to be compressed, which is
not allowed.

    Solution: always recompress to 0 after merging.
YaacovHazan pushed a commit to YaacovHazan/redis that referenced this pull request May 16, 2024
…edis#13040)

Fix two crash introducted by redis#12955

When a quicklist node can't be inserted and split, we eventually merge
the current node with its neighboring
nodes after inserting, and compress the current node and its siblings.

1. When the current node is merged with another node, the current node
may become invalid and can no longer be used.

   Solution: let `_quicklistMergeNodes()` return the merged nodes.

3. If the current node is a LZF quicklist node, its recompress will be
1. If the split node can be merged with a sibling node to become head or
tail, recompress may cause the head and tail to be compressed, which is
not allowed.

    Solution: always recompress to 0 after merging.

(cherry picked from commit 1e8dc1d)
YaacovHazan pushed a commit that referenced this pull request May 19, 2024
Fix two crash introducted by #12955

When a quicklist node can't be inserted and split, we eventually merge
the current node with its neighboring
nodes after inserting, and compress the current node and its siblings.

1. When the current node is merged with another node, the current node
may become invalid and can no longer be used.

   Solution: let `_quicklistMergeNodes()` return the merged nodes.

3. If the current node is a LZF quicklist node, its recompress will be
1. If the split node can be merged with a sibling node to become head or
tail, recompress may cause the head and tail to be compressed, which is
not allowed.

    Solution: always recompress to 0 after merging.

(cherry picked from commit 1e8dc1d)
funny-dog pushed a commit to funny-dog/redis that referenced this pull request Sep 17, 2025
…edis#13040)

Fix two crash introducted by redis#12955

When a quicklist node can't be inserted and split, we eventually merge
the current node with its neighboring
nodes after inserting, and compress the current node and its siblings.

1. When the current node is merged with another node, the current node
may become invalid and can no longer be used.

   Solution: let `_quicklistMergeNodes()` return the merged nodes.

3. If the current node is a LZF quicklist node, its recompress will be
1. If the split node can be merged with a sibling node to become head or
tail, recompress may cause the head and tail to be compressed, which is
not allowed.

    Solution: always recompress to 0 after merging.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants