Skip to content

Commit

Permalink
Fix SISMEMBER should return 0 when key does not exist (#1661)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
enjoy-binbin committed Aug 11, 2023
1 parent f432e6c commit 8d4abd4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/commands/cmd_set.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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()};
}

Expand Down

0 comments on commit 8d4abd4

Please sign in to comment.