This is an automated email from the ASF dual-hosted git repository.
twice pushed a commit to branch unstable
in repository https://gitbox.apache.org/repos/asf/kvrocks.git
The following commit(s) were added to refs/heads/unstable by this push:
new a68caeb57 fix(command): Fix MSETEX key range for command (#3336)
a68caeb57 is described below
commit a68caeb5719a54489238924e45b483c4284c508e
Author: Byeonggyu Park <[email protected]>
AuthorDate: Fri Jan 9 02:40:22 2026 +0900
fix(command): Fix MSETEX key range for command (#3336)
Fix key range of MSETEX to return accurate key list with `COMMAND
GETKEYS MSETEX`
close #3335
---
src/commands/cmd_string.cc | 2 +-
tests/gocase/unit/command/command_test.go | 9 +++++++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/commands/cmd_string.cc b/src/commands/cmd_string.cc
index fd43fda72..d9ff39770 100644
--- a/src/commands/cmd_string.cc
+++ b/src/commands/cmd_string.cc
@@ -545,7 +545,7 @@ class CommandMSetEX : public Commander {
static CommandKeyRange Range(const std::vector<std::string> &args) {
int num_keys = *ParseInt<int>(args[1], 10);
- return {2, 2 + 2 * num_keys, 2};
+ return {2, 2 * num_keys, 2};
}
private:
diff --git a/tests/gocase/unit/command/command_test.go
b/tests/gocase/unit/command/command_test.go
index 0331155b8..9a065c281 100644
--- a/tests/gocase/unit/command/command_test.go
+++ b/tests/gocase/unit/command/command_test.go
@@ -104,6 +104,15 @@ func TestCommand(t *testing.T) {
require.Equal(t, "test", vs[0])
})
+ t.Run("COMMAND GETKEYS MSETEX", func(t *testing.T) {
+ r := rdb.Do(ctx, "COMMAND", "GETKEYS", "MSETEX", "2", "k1",
"v1", "k2", "v2", "NX", "KEEPTTL")
+ vs, err := r.Slice()
+ require.NoError(t, err)
+ require.Len(t, vs, 2)
+ require.Equal(t, "k1", vs[0])
+ require.Equal(t, "k2", vs[1])
+ })
+
t.Run("COMMAND GETKEYS SINTERCARD", func(t *testing.T) {
r := rdb.Do(ctx, "COMMAND", "GETKEYS", "SINTERCARD", "2",
"key1", "key2")
vs, err := r.Slice()