Skip to content

RM_ZsetRem: Delete key if empty#8453

Merged
oranagra merged 1 commit intoredis:unstablefrom
zuiderkwast:zset-rem-empty
Feb 5, 2021
Merged

RM_ZsetRem: Delete key if empty#8453
oranagra merged 1 commit intoredis:unstablefrom
zuiderkwast:zset-rem-empty

Conversation

@zuiderkwast
Copy link
Contributor

Without this fix, RM_ZsetRem can leave empty sorted sets which are
not allowed to exist.

Fixes #4859.

@itamarhaber
Copy link
Member

Woot!

Without this fix, RM_ZsetRem can leave empty sorted sets which are
not allowed to exist.

Removing from a sorted set while iterating seems to work (while
inserting causes failed assetions). RM_ZsetRangeEndReached is
modified to return 1 if the key doesn't exist, to terminate
iteration when the last element has been removed.
@oranagra oranagra added the release-notes indication that this issue needs to be mentioned in the release notes label Feb 5, 2021
@oranagra oranagra merged commit aea6e71 into redis:unstable Feb 5, 2021
@zuiderkwast zuiderkwast deleted the zset-rem-empty branch February 5, 2021 18:33
This was referenced Feb 22, 2021
oranagra pushed a commit that referenced this pull request Feb 22, 2021
Without this fix, RM_ZsetRem can leave empty sorted sets which are
not allowed to exist.

Removing from a sorted set while iterating seems to work (while
inserting causes failed assetions). RM_ZsetRangeEndReached is
modified to return 1 if the key doesn't exist, to terminate
iteration when the last element has been removed.

(cherry picked from commit aea6e71)
oranagra pushed a commit that referenced this pull request Feb 22, 2021
Without this fix, RM_ZsetRem can leave empty sorted sets which are
not allowed to exist.

Removing from a sorted set while iterating seems to work (while
inserting causes failed assetions). RM_ZsetRangeEndReached is
modified to return 1 if the key doesn't exist, to terminate
iteration when the last element has been removed.

(cherry picked from commit aea6e71)
JackieXie168 pushed a commit to JackieXie168/redis that referenced this pull request Mar 2, 2021
Without this fix, RM_ZsetRem can leave empty sorted sets which are
not allowed to exist.

Removing from a sorted set while iterating seems to work (while
inserting causes failed assetions). RM_ZsetRangeEndReached is
modified to return 1 if the key doesn't exist, to terminate
iteration when the last element has been removed.
oranagra added a commit that referenced this pull request Aug 5, 2021
…mmand (#9297)

When we load rdb or restore command, if we encounter a length of 0, it will result in the creation of an empty key.
This could either be a corrupt payload, or a result of a bug (see #8453 )

This PR mainly fixes the following:
1) When restore command will return `Bad data format` error.
2) When loading RDB, we will silently discard the key.

Co-authored-by: Oran Agra <[email protected]>
JackieXie168 pushed a commit to JackieXie168/redis that referenced this pull request Sep 8, 2021
…mmand (redis#9297)

When we load rdb or restore command, if we encounter a length of 0, it will result in the creation of an empty key.
This could either be a corrupt payload, or a result of a bug (see redis#8453 )

This PR mainly fixes the following:
1) When restore command will return `Bad data format` error.
2) When loading RDB, we will silently discard the key.

Co-authored-by: Oran Agra <[email protected]>
@zuiderkwast zuiderkwast mentioned this pull request Sep 14, 2021
52 tasks
oranagra added a commit that referenced this pull request Oct 4, 2021
…mmand (#9297)

When we load rdb or restore command, if we encounter a length of 0, it will result in the creation of an empty key.
This could either be a corrupt payload, or a result of a bug (see #8453 )

This PR mainly fixes the following:
1) When restore command will return `Bad data format` error.
2) When loading RDB, we will silently discard the key.

Co-authored-by: Oran Agra <[email protected]>
(cherry picked from commit 8ea777a)
pulllock pushed a commit to pulllock/redis that referenced this pull request Jun 28, 2023
Without this fix, RM_ZsetRem can leave empty sorted sets which are
not allowed to exist.

Removing from a sorted set while iterating seems to work (while
inserting causes failed assetions). RM_ZsetRangeEndReached is
modified to return 1 if the key doesn't exist, to terminate
iteration when the last element has been removed.

(cherry picked from commit aea6e71)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-notes indication that this issue needs to be mentioned in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RedisModule_ZsetRem can lead to "empty" zset keys

3 participants