This is an automated email from the ASF dual-hosted git repository.
git-hulk 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 d42d0c7f7 fix(zset): register zdiffstore as write command (#3486)
d42d0c7f7 is described below
commit d42d0c7f74d51b26d8cf982961a9f10de1e33baa
Author: 纪华裕 <[email protected]>
AuthorDate: Wed May 13 14:19:04 2026 +0800
fix(zset): register zdiffstore as write command (#3486)
`ZDIFFSTORE` writes results to a destination key, but it was previously
registered as `read-only slow`. I fix it.
I used codex gpt-5.5 to find and fix it.
---
src/commands/cmd_zset.cc | 2 +-
tests/gocase/unit/command/command_test.go | 12 ++++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/commands/cmd_zset.cc b/src/commands/cmd_zset.cc
index 1d943e8ef..09bfe0e93 100644
--- a/src/commands/cmd_zset.cc
+++ b/src/commands/cmd_zset.cc
@@ -1594,6 +1594,6 @@ REDIS_REGISTER_COMMANDS(ZSet,
MakeCmdAttr<CommandZAdd>("zadd", -4, "write", 1, 1
MakeCmdAttr<CommandZUnion>("zunion", -3, "read-only
slow", CommandZUnion::Range),
MakeCmdAttr<CommandZRandMember>("zrandmember", -2,
"read-only", 1, 1, 1),
MakeCmdAttr<CommandZDiff>("zdiff", -3, "read-only
slow", CommandZDiff::Range),
- MakeCmdAttr<CommandZDiffStore>("zdiffstore", -3,
"read-only slow", CommandZDiffStore::Range), )
+ MakeCmdAttr<CommandZDiffStore>("zdiffstore", -3,
"write slow", CommandZDiffStore::Range), )
} // namespace redis
diff --git a/tests/gocase/unit/command/command_test.go
b/tests/gocase/unit/command/command_test.go
index 9a065c281..eeda5fa54 100644
--- a/tests/gocase/unit/command/command_test.go
+++ b/tests/gocase/unit/command/command_test.go
@@ -53,6 +53,18 @@ func TestCommand(t *testing.T) {
require.EqualValues(t, 1, v[5])
})
+ t.Run("acquire ZDIFFSTORE command info by COMMAND INFO", func(t
*testing.T) {
+ r := rdb.Do(ctx, "COMMAND", "INFO", "ZDIFFSTORE")
+ vs, err := r.Slice()
+ require.NoError(t, err)
+ require.Len(t, vs, 1)
+ v := vs[0].([]interface{})
+ require.Len(t, v, 6)
+ require.Equal(t, "zdiffstore", v[0])
+ require.EqualValues(t, -3, v[1])
+ require.Equal(t, []interface{}{"write", "slow"}, v[2])
+ })
+
t.Run("acquire renamed command info by COMMAND INFO", func(t
*testing.T) {
r := rdb.Do(ctx, "COMMAND", "INFO", "KEYS")
vs, err := r.Slice()