Skip to content

Fix hgetf/hsetf reply type by returning string#13263

Merged
tezc merged 2 commits intoredis:hash-field-expiry-integfrom
tezc:hgetf-fix
May 13, 2024
Merged

Fix hgetf/hsetf reply type by returning string#13263
tezc merged 2 commits intoredis:hash-field-expiry-integfrom
tezc:hgetf-fix

Conversation

@tezc
Copy link
Copy Markdown
Collaborator

@tezc tezc commented May 13, 2024

If encoding is listpack, hgetf and hsetf commands reply field value type as integer.
This PR fixes it by returning string.

Problematic cases:

127.0.0.1:6379> hset hash one 1
(integer) 1
127.0.0.1:6379> hgetf hash fields 1 one
1) (integer) 1
127.0.0.1:6379> hsetf hash GETOLD fvs 1 one 2
1) (integer) 1
127.0.0.1:6379> hsetf hash DOF GETNEW fvs 1 one 2
1) (integer) 2

Additional fixes:

  • hgetf/hsetf command description text

Fixes #13261, #13262

@tezc tezc requested review from moticless, ronen-kalish and sundb May 13, 2024 07:01
Comment thread src/commands/hgetf.json
"summary": "For each specified field: get its value and optionally set the field's remaining time to live / UNIX expiration timestamp in seconds / milliseconds",
"complexity": "O(N) where N is the number of arguments to the command",
"group": "hash",
"since": "8.0.0",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be 7.4 (for all HFE commands)?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm aware of this and we need to change it for all hfe commands. I'll address in a future PR.

@tezc tezc merged commit 5066e6e into redis:hash-field-expiry-integ May 13, 2024
@tezc tezc deleted the hgetf-fix branch May 13, 2024 08:29
funny-dog pushed a commit to funny-dog/redis that referenced this pull request Sep 17, 2025
If encoding is listpack, hgetf and hsetf commands reply field value type
as integer.
This PR fixes it by returning string.

Problematic cases:
```
127.0.0.1:6379> hset hash one 1
(integer) 1
127.0.0.1:6379> hgetf hash fields 1 one
1) (integer) 1
127.0.0.1:6379> hsetf hash GETOLD fvs 1 one 2
1) (integer) 1
127.0.0.1:6379> hsetf hash DOF GETNEW fvs 1 one 2
1) (integer) 2
```

Additional fixes:
- hgetf/hsetf command description text

Fixes redis#13261, redis#13262
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants