-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Adds count to L/RPOP #8179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Adds count to L/RPOP #8179
Conversation
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
madolson
reviewed
Dec 13, 2020
oranagra
reviewed
Dec 13, 2020
oranagra
reviewed
Dec 18, 2020
oranagra
approved these changes
Dec 20, 2020
yossigo
approved these changes
Dec 20, 2020
Member
Author
|
@redis/core-team please review and approve if you haven't already. Thanks. |
madolson
approved these changes
Dec 22, 2020
Merged
JackieXie168
pushed a commit
to JackieXie168/redis
that referenced
this pull request
Mar 2, 2021
Adds: `L/RPOP <key> [count]` Implements no. 2 of the following strategies: 1. Loop on listTypePop - this would result in multiple calls for memory freeing and allocating (see redis@769167a) 2. Iterate the range to build the reply, then call quickListDelRange - this requires two iterations and **is the current choice** 3. Refactor quicklist to have a pop variant of quickListDelRange - probably optimal but more complex Also: * There's a historical check for NULL after calling listTypePop that was converted to an assert. * This refactors common logic shared between LRANGE and the new form of LPOP/RPOP into addListRangeReply (adds test for b/w compat) * Consequently, it may have made sense to have `LRANGE l -1 -2` and `LRANGE l 9 0` be legit and return a reverse reply. Due to historical reasons that would be, however, a breaking change. * Added minimal comments to existing commands to adhere to the style, make core dev life easier and get commit karma, naturally.
This was referenced Oct 27, 2021
oranagra
pushed a commit
that referenced
this pull request
Nov 4, 2021
Introduced in #8179, this fixes the command's replies in the 0 count edge case. [BREAKING] changes the reply type when count is 0 to an empty array (instead of nil) Moves LPOP ... 0 fast exit path after type check to reply with WRONGTYPE
enjoy-binbin
added a commit
to enjoy-binbin/redis
that referenced
this pull request
Jan 10, 2022
It used to return `$-1` in RESP2, now we will return `*-1`. This is a bug in redis 6.2 when COUNT was added, the `COUNT` option was introduced in redis#8179. Fix redis#10089.
oranagra
pushed a commit
that referenced
this pull request
Jan 11, 2022
) It used to return `$-1` in RESP2, now we will return `*-1`. This is a bug in redis 6.2 when COUNT was added, the `COUNT` option was introduced in #8179. Fix #10089. the documentation of [LPOP](https://redis.io/commands/lpop) says ``` When called without the count argument: Bulk string reply: the value of the first element, or nil when key does not exist. When called with the count argument: Array reply: list of popped elements, or nil when key does not exist. ```
oranagra
pushed a commit
that referenced
this pull request
Apr 27, 2022
) It used to return `$-1` in RESP2, now we will return `*-1`. This is a bug in redis 6.2 when COUNT was added, the `COUNT` option was introduced in #8179. Fix #10089. the documentation of [LPOP](https://redis.io/commands/lpop) says ``` When called without the count argument: Bulk string reply: the value of the first element, or nil when key does not exist. When called with the count argument: Array reply: list of popped elements, or nil when key does not exist. ``` (cherry picked from commit 39feee8)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
approval-needed
Waiting for core team approval to be merged
release-notes
indication that this issue needs to be mentioned in the release notes
state:major-decision
Requires core team consensus
state:needs-doc-pr
requires a PR to redis-doc repository
state:to-be-merged
The PR should be merged soon, even if not yet ready, this is used so that it won't be forgotten
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.
Implements the
[count]variant ofL/RPOP, provides partial resolution for #766 but leaves the blocking variants untouched for now.Adds:
L/RPOP <key> [count]Implements no. 2 of the following strategies:
Also:
LRANGE l -1 -2andLRANGE l 9 0be legit and return a reverse reply. Due to historical reasons that would be, however, a breaking change.