Adds HGETDEL Support to Valkey - #2851
Conversation
Signed-off-by: Roshan Khatri <rvkhatri@amazon.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## unstable #2851 +/- ##
=========================================
Coverage 72.41% 72.41%
=========================================
Files 128 128
Lines 70439 70469 +30
=========================================
+ Hits 51006 51029 +23
- Misses 19433 19440 +7
🚀 New features to boost your workflow:
|
|
@valkey-io/core-team I would like to add this pr to next meeting agenda to discuss more, Thanks |
|
I think it is one feature to align with Redis 8 |
|
If it's the same syntax as in Redis 8, I vote YES. |
It is not, but I can make it the same |
|
Ah... Redis insist on using this very ugly syntax for all new commands. It appears to be designed for machine generated command lines, not humans. I think your syntax @valkey-io/client-maintainers WDYT? |
|
Yeah, it is the same as HTTL https://valkey.io/commands/httl/ The one I implemented is similar to HMGET: I think we have similar syntax in valkey as well so it would be generally better to keep compatibility |
|
I like consistency with HMGET better than creating a weird syntax just to align with Redis. That said, IF the 3rd parameter is a number AND the number equals the number of remaining parameters, we could just silently ignore it. But, unfortunately, that becomes ambiguous in a case like this: HGETDEL key 3 4 5 6 - is "3" a field? or a count of fields? |
hpatro
left a comment
There was a problem hiding this comment.
Regarding the syntax, users migrating from Redis to Valkey will have problems if we don't choose to stick with it. We have decided to stick through with so many of features so far (Hash field expiration / Search / JSON). So, I think we should continue have symmetry with them atleast on the data path commands which were introduced there first.
Signed-off-by: Roshan Khatri <rvkhatri@amazon.com>
Signed-off-by: Roshan Khatri <rvkhatri@amazon.com>
|
Breaking API with Redis will mean that client maintainers might need to choose sides, and only fully support one DB, and offer partial support for the other, which will also lead to poor UX for the client users, since these details are easy to miss, and expectations won't match reality. |
|
Updated the top comment and this PR now maintain syntax compatibility. |
|
I have one question: In Redis 8.0, it introduces this command HGETDEL, the open source license was changed before Redis 8.0. I am not sure how many users migrating from Redis 8.0 to Valkey? Do we need still align with the Redis weird syntax? Honestly, I do not like the format: HGETDEL key FIELDS numfields field [field ...] |
ranshid
left a comment
There was a problem hiding this comment.
Gave a quick one (and will continue tomorrow)
Looks good overall. I would be happy if we can also include a test in hashexpire.tcl to test the command when there are expired fields.
I also do not like the FIELDS (although it has advantages for adding future command arguments), but I agree with the state that we should be more aligned with the client ecosystem needs and I think it is overriding personal taste ATM. |
|
As a client maintainer, I suggest aligning with the weird syntax as long as the command name remains the same. |
Signed-off-by: Roshan Khatri <rvkhatri@amazon.com>
|
I vote for use Redis syntax. (for save time and compatibility, Redis client for Valkey, Valkey client for Redis)
|
|
@valkey-io/core-team Let me summarize the decision points:
|
Now the syntax is same as redis https://redis.io/docs/latest/commands/hgetdel/ |
|
@valkey-io/core-team do you want to try and take a decision offline (on this PR) or should I schedule this to be a topic on Monday? |
|
Also +1 for Wen's comments. (Yes, align with Redis syntax, O(n), single hdel event.) |
|
#2875) When we added the Hash Field Expiration feature in Valkey 9.0, some of the new command docs included complexity description of O(1) even tough they except multiple arguments. (see discussion in #2851 (comment)) This PR does: 1. align all the commands to the same description 2. fix the complexity description of some commands (eg HSETEX and HGETEX) --------- Signed-off-by: Ran Shidlansik <ranshid@amazon.com>
valkey-io#2875) When we added the Hash Field Expiration feature in Valkey 9.0, some of the new command docs included complexity description of O(1) even tough they except multiple arguments. (see discussion in valkey-io#2851 (comment)) This PR does: 1. align all the commands to the same description 2. fix the complexity description of some commands (eg HSETEX and HGETEX) --------- Signed-off-by: Ran Shidlansik <ranshid@amazon.com>
Signed-off-by: Ran Shidlansik <ranshid@amazon.com>
Signed-off-by: Ran Shidlansik <ranshid@amazon.com>
valkey-io#2875) When we added the Hash Field Expiration feature in Valkey 9.0, some of the new command docs included complexity description of O(1) even tough they except multiple arguments. (see discussion in valkey-io#2851 (comment)) This PR does: 1. align all the commands to the same description 2. fix the complexity description of some commands (eg HSETEX and HGETEX) --------- Signed-off-by: Ran Shidlansik <ranshid@amazon.com>
Fixes this: valkey-io#2850 Adds support for HGETDEL to Valkey and aligns with Redis 8.0 feature. Maintains syntax compatibility Retrieves all the values, and null if fields dont exists and deletes once retrieved. ``` 127.0.0.1:6379> HGETDEL key FIELDS numfields field [ field ... ] ``` ``` 127.0.0.1:6379> HSET foo field1 bar1 field2 bar2 field3 bar3 (integer) 3 127.0.0.1:6379> HGETDEL foo FIELDS 1 field2 1) "bar2" 127.0.0.1:6379> HGETDEL foo FIELDS 1 field2 1) (nil) 127.0.0.1:6379> HGETALL foo 1) "field1" 2) "bar1" 3) "field3" 4) "bar3" 127.0.0.1:6379> HGETDEL foo FIELDS 2 field2 field3 1) (nil) 2) "bar3" 127.0.0.1:6379> HGETALL foo 1) "field1" 2) "bar1" 127.0.0.1:6379> HGETDEL foo FIELDS 3 field1 non-exist-field (error) ERR syntax error 127.0.0.1:6379> HGETDEL foo FIELDS 2 field1 non-exist-field 1) "bar1" 2) (nil) 127.0.0.1:6379> HGETALL foo (empty array) 127.0.0.1:6379> ``` --------- Signed-off-by: Roshan Khatri <rvkhatri@amazon.com> Signed-off-by: Ran Shidlansik <ranshid@amazon.com> Co-authored-by: Ran Shidlansik <ranshid@amazon.com>
valkey-io#2875) When we added the Hash Field Expiration feature in Valkey 9.0, some of the new command docs included complexity description of O(1) even tough they except multiple arguments. (see discussion in valkey-io#2851 (comment)) This PR does: 1. align all the commands to the same description 2. fix the complexity description of some commands (eg HSETEX and HGETEX) --------- Signed-off-by: Ran Shidlansik <ranshid@amazon.com>
Fixes this: valkey-io#2850 Adds support for HGETDEL to Valkey and aligns with Redis 8.0 feature. Maintains syntax compatibility Retrieves all the values, and null if fields dont exists and deletes once retrieved. ``` 127.0.0.1:6379> HGETDEL key FIELDS numfields field [ field ... ] ``` ``` 127.0.0.1:6379> HSET foo field1 bar1 field2 bar2 field3 bar3 (integer) 3 127.0.0.1:6379> HGETDEL foo FIELDS 1 field2 1) "bar2" 127.0.0.1:6379> HGETDEL foo FIELDS 1 field2 1) (nil) 127.0.0.1:6379> HGETALL foo 1) "field1" 2) "bar1" 3) "field3" 4) "bar3" 127.0.0.1:6379> HGETDEL foo FIELDS 2 field2 field3 1) (nil) 2) "bar3" 127.0.0.1:6379> HGETALL foo 1) "field1" 2) "bar1" 127.0.0.1:6379> HGETDEL foo FIELDS 3 field1 non-exist-field (error) ERR syntax error 127.0.0.1:6379> HGETDEL foo FIELDS 2 field1 non-exist-field 1) "bar1" 2) (nil) 127.0.0.1:6379> HGETALL foo (empty array) 127.0.0.1:6379> ``` --------- Signed-off-by: Roshan Khatri <rvkhatri@amazon.com> Signed-off-by: Ran Shidlansik <ranshid@amazon.com> Co-authored-by: Ran Shidlansik <ranshid@amazon.com>
valkey-io#2875) When we added the Hash Field Expiration feature in Valkey 9.0, some of the new command docs included complexity description of O(1) even tough they except multiple arguments. (see discussion in valkey-io#2851 (comment)) This PR does: 1. align all the commands to the same description 2. fix the complexity description of some commands (eg HSETEX and HGETEX) --------- Signed-off-by: Ran Shidlansik <ranshid@amazon.com>
Fixes this: valkey-io#2850 Adds support for HGETDEL to Valkey and aligns with Redis 8.0 feature. Maintains syntax compatibility Retrieves all the values, and null if fields dont exists and deletes once retrieved. ``` 127.0.0.1:6379> HGETDEL key FIELDS numfields field [ field ... ] ``` ``` 127.0.0.1:6379> HSET foo field1 bar1 field2 bar2 field3 bar3 (integer) 3 127.0.0.1:6379> HGETDEL foo FIELDS 1 field2 1) "bar2" 127.0.0.1:6379> HGETDEL foo FIELDS 1 field2 1) (nil) 127.0.0.1:6379> HGETALL foo 1) "field1" 2) "bar1" 3) "field3" 4) "bar3" 127.0.0.1:6379> HGETDEL foo FIELDS 2 field2 field3 1) (nil) 2) "bar3" 127.0.0.1:6379> HGETALL foo 1) "field1" 2) "bar1" 127.0.0.1:6379> HGETDEL foo FIELDS 3 field1 non-exist-field (error) ERR syntax error 127.0.0.1:6379> HGETDEL foo FIELDS 2 field1 non-exist-field 1) "bar1" 2) (nil) 127.0.0.1:6379> HGETALL foo (empty array) 127.0.0.1:6379> ``` --------- Signed-off-by: Roshan Khatri <rvkhatri@amazon.com> Signed-off-by: Ran Shidlansik <ranshid@amazon.com> Co-authored-by: Ran Shidlansik <ranshid@amazon.com>
valkey-io#2875) When we added the Hash Field Expiration feature in Valkey 9.0, some of the new command docs included complexity description of O(1) even tough they except multiple arguments. (see discussion in valkey-io#2851 (comment)) This PR does: 1. align all the commands to the same description 2. fix the complexity description of some commands (eg HSETEX and HGETEX) --------- Signed-off-by: Ran Shidlansik <ranshid@amazon.com>
#2875) When we added the Hash Field Expiration feature in Valkey 9.0, some of the new command docs included complexity description of O(1) even tough they except multiple arguments. (see discussion in #2851 (comment)) This PR does: 1. align all the commands to the same description 2. fix the complexity description of some commands (eg HSETEX and HGETEX) --------- Signed-off-by: Ran Shidlansik <ranshid@amazon.com>
valkey-io#2875) When we added the Hash Field Expiration feature in Valkey 9.0, some of the new command docs included complexity description of O(1) even tough they except multiple arguments. (see discussion in valkey-io#2851 (comment)) This PR does: 1. align all the commands to the same description 2. fix the complexity description of some commands (eg HSETEX and HGETEX) --------- Signed-off-by: Ran Shidlansik <ranshid@amazon.com>
Fixes this: valkey-io#2850 Adds support for HGETDEL to Valkey and aligns with Redis 8.0 feature. Maintains syntax compatibility Retrieves all the values, and null if fields dont exists and deletes once retrieved. ``` 127.0.0.1:6379> HGETDEL key FIELDS numfields field [ field ... ] ``` ``` 127.0.0.1:6379> HSET foo field1 bar1 field2 bar2 field3 bar3 (integer) 3 127.0.0.1:6379> HGETDEL foo FIELDS 1 field2 1) "bar2" 127.0.0.1:6379> HGETDEL foo FIELDS 1 field2 1) (nil) 127.0.0.1:6379> HGETALL foo 1) "field1" 2) "bar1" 3) "field3" 4) "bar3" 127.0.0.1:6379> HGETDEL foo FIELDS 2 field2 field3 1) (nil) 2) "bar3" 127.0.0.1:6379> HGETALL foo 1) "field1" 2) "bar1" 127.0.0.1:6379> HGETDEL foo FIELDS 3 field1 non-exist-field (error) ERR syntax error 127.0.0.1:6379> HGETDEL foo FIELDS 2 field1 non-exist-field 1) "bar1" 2) (nil) 127.0.0.1:6379> HGETALL foo (empty array) 127.0.0.1:6379> ``` --------- Signed-off-by: Roshan Khatri <rvkhatri@amazon.com> Signed-off-by: Ran Shidlansik <ranshid@amazon.com> Co-authored-by: Ran Shidlansik <ranshid@amazon.com>
valkey-io#2875) When we added the Hash Field Expiration feature in Valkey 9.0, some of the new command docs included complexity description of O(1) even tough they except multiple arguments. (see discussion in valkey-io#2851 (comment)) This PR does: 1. align all the commands to the same description 2. fix the complexity description of some commands (eg HSETEX and HGETEX) --------- Signed-off-by: Ran Shidlansik <ranshid@amazon.com>
Fixes this: valkey-io#2850 Adds support for HGETDEL to Valkey and aligns with Redis 8.0 feature. Maintains syntax compatibility Retrieves all the values, and null if fields dont exists and deletes once retrieved. ``` 127.0.0.1:6379> HGETDEL key FIELDS numfields field [ field ... ] ``` ``` 127.0.0.1:6379> HSET foo field1 bar1 field2 bar2 field3 bar3 (integer) 3 127.0.0.1:6379> HGETDEL foo FIELDS 1 field2 1) "bar2" 127.0.0.1:6379> HGETDEL foo FIELDS 1 field2 1) (nil) 127.0.0.1:6379> HGETALL foo 1) "field1" 2) "bar1" 3) "field3" 4) "bar3" 127.0.0.1:6379> HGETDEL foo FIELDS 2 field2 field3 1) (nil) 2) "bar3" 127.0.0.1:6379> HGETALL foo 1) "field1" 2) "bar1" 127.0.0.1:6379> HGETDEL foo FIELDS 3 field1 non-exist-field (error) ERR syntax error 127.0.0.1:6379> HGETDEL foo FIELDS 2 field1 non-exist-field 1) "bar1" 2) (nil) 127.0.0.1:6379> HGETALL foo (empty array) 127.0.0.1:6379> ``` --------- Signed-off-by: Roshan Khatri <rvkhatri@amazon.com> Signed-off-by: Ran Shidlansik <ranshid@amazon.com> Co-authored-by: Ran Shidlansik <ranshid@amazon.com>
Adds documentation for `HGETDEL` command which was added here: valkey-io/valkey#2851 Signed-off-by: Roshan Khatri <rvkhatri@amazon.com>
valkey-io#2875) When we added the Hash Field Expiration feature in Valkey 9.0, some of the new command docs included complexity description of O(1) even tough they except multiple arguments. (see discussion in valkey-io#2851 (comment)) This PR does: 1. align all the commands to the same description 2. fix the complexity description of some commands (eg HSETEX and HGETEX) --------- Signed-off-by: Ran Shidlansik <ranshid@amazon.com> Signed-off-by: Harkrishn Patro <bunty.hari@gmail.com>
Fixes this: valkey-io#2850 Adds support for HGETDEL to Valkey and aligns with Redis 8.0 feature. Maintains syntax compatibility Retrieves all the values, and null if fields dont exists and deletes once retrieved. ``` 127.0.0.1:6379> HGETDEL key FIELDS numfields field [ field ... ] ``` ``` 127.0.0.1:6379> HSET foo field1 bar1 field2 bar2 field3 bar3 (integer) 3 127.0.0.1:6379> HGETDEL foo FIELDS 1 field2 1) "bar2" 127.0.0.1:6379> HGETDEL foo FIELDS 1 field2 1) (nil) 127.0.0.1:6379> HGETALL foo 1) "field1" 2) "bar1" 3) "field3" 4) "bar3" 127.0.0.1:6379> HGETDEL foo FIELDS 2 field2 field3 1) (nil) 2) "bar3" 127.0.0.1:6379> HGETALL foo 1) "field1" 2) "bar1" 127.0.0.1:6379> HGETDEL foo FIELDS 3 field1 non-exist-field (error) ERR syntax error 127.0.0.1:6379> HGETDEL foo FIELDS 2 field1 non-exist-field 1) "bar1" 2) (nil) 127.0.0.1:6379> HGETALL foo (empty array) 127.0.0.1:6379> ``` --------- Signed-off-by: Roshan Khatri <rvkhatri@amazon.com> Signed-off-by: Ran Shidlansik <ranshid@amazon.com> Co-authored-by: Ran Shidlansik <ranshid@amazon.com> Signed-off-by: Harkrishn Patro <bunty.hari@gmail.com>
…s (#2875) When we added the Hash Field Expiration feature in Valkey 9.0, some of the new command docs included complexity description of O(1) even tough they except multiple arguments. (see discussion in valkey-io/valkey#2851 (comment)) This PR does: 1. align all the commands to the same description 2. fix the complexity description of some commands (eg HSETEX and HGETEX) --------- Signed-off-by: Ran Shidlansik <ranshid@amazon.com>
…s (#2875) When we added the Hash Field Expiration feature in Valkey 9.0, some of the new command docs included complexity description of O(1) even tough they except multiple arguments. (see discussion in valkey-io/valkey#2851 (comment)) This PR does: 1. align all the commands to the same description 2. fix the complexity description of some commands (eg HSETEX and HGETEX) --------- Signed-off-by: Ran Shidlansik <ranshid@amazon.com>
Fixes #2850.
Adds support for HGETDEL to Valkey and aligns with Redis 8.0 feature.
Maintains syntax compatibility
Retrieves all the values, and null if fields dont exists and deletes once retrieved.