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 adbf8c3ff fix(zset): wrong RESP reply in ZMSCORE command for
non-existent key (#2983)
adbf8c3ff is described below
commit adbf8c3ff948f8a0b3ea3bf50259752241d326ce
Author: weimeng <[email protected]>
AuthorDate: Tue May 20 16:09:35 2025 +0800
fix(zset): wrong RESP reply in ZMSCORE command for non-existent key (#2983)
Co-authored-by: weimeng <[email protected]>
---
src/commands/cmd_zset.cc | 2 +-
tests/gocase/unit/type/zset/zset_test.go | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/commands/cmd_zset.cc b/src/commands/cmd_zset.cc
index 49fb1f7a5..351ffb7d5 100644
--- a/src/commands/cmd_zset.cc
+++ b/src/commands/cmd_zset.cc
@@ -1104,7 +1104,7 @@ class CommandZMScore : public Commander {
std::vector<std::string> values;
if (s.IsNotFound()) {
- values.resize(members.size(), "");
+ values.resize(members.size(), conn->NilString());
} else {
for (const auto &member : members) {
auto iter = mscores.find(member.ToString());
diff --git a/tests/gocase/unit/type/zset/zset_test.go
b/tests/gocase/unit/type/zset/zset_test.go
index 90a495000..d4a7a83f9 100644
--- a/tests/gocase/unit/type/zset/zset_test.go
+++ b/tests/gocase/unit/type/zset/zset_test.go
@@ -1309,6 +1309,8 @@ func basicTests(t *testing.T, rdb *redis.Client, ctx
context.Context, enabledRES
res := rdb.ZMScore(ctx, "zset", "a", "b").Val()
require.Equal(t, int64(1), int64(res[0]))
require.Equal(t, int64(2), int64(res[1]))
+
+ require.Equal(t, nil, rdb.ZMScore(ctx, "non-existent-zset",
"a").Err())
})
t.Run(fmt.Sprintf("ZRANDMEMBER without scores - %s", encoding), func(t
*testing.T) {