This is an automated email from the ASF dual-hosted git repository.
binbin 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 8d4abd4d Fix SISMEMBER should return 0 when key does not exist (#1661)
8d4abd4d is described below
commit 8d4abd4dd907b7c1b70e635786f821ea786a649f
Author: Binbin <[email protected]>
AuthorDate: Fri Aug 11 17:44:11 2023 +0800
Fix SISMEMBER should return 0 when key does not exist (#1661)
Because we didn't check for not found, causing SISMEMBER
to return an error instead of 0 when the key doesn't exist:
```
127.0.0.1:6379> SISMEMBER foo bar
(integer) 0
127.0.0.1:6666> SISMEMBER foo bar
(error) ERR NotFound:
```
I also checked smismember and it's ok.
Fixes #1659.
---
src/commands/cmd_set.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/commands/cmd_set.cc b/src/commands/cmd_set.cc
index 586cad4c..5ec1b7ba 100644
--- a/src/commands/cmd_set.cc
+++ b/src/commands/cmd_set.cc
@@ -104,7 +104,7 @@ class CommandSIsMember : public Commander {
redis::Set set_db(svr->storage, conn->GetNamespace());
bool ret = false;
auto s = set_db.IsMember(args_[1], args_[2], &ret);
- if (!s.ok()) {
+ if (!s.ok() && !s.IsNotFound()) {
return {Status::RedisExecErr, s.ToString()};
}