You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kvrocks.apache.org by "weim0000 (via GitHub)" <gi...@apache.org> on 2025/05/12 07:28:50 UTC
[PR] Fix zrandmember coredump [kvrocks]
weim0000 opened a new pull request, #2982:
URL: https://github.com/apache/kvrocks/pull/2982
when exec 'zrandmember key', if key is not exist, then kvrocks will coredump.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(zset): crash in ZRANDMEMBER for non-existent keys [kvrocks]
Posted by "PragmaTwice (via GitHub)" <gi...@apache.org>.
PragmaTwice commented on code in PR #2982:
URL: https://github.com/apache/kvrocks/pull/2982#discussion_r2085871032
##########
tests/gocase/unit/type/zset/zset_test.go:
##########
@@ -1324,6 +1324,10 @@ func basicTests(t *testing.T, rdb *redis.Client, ctx context.Context, enabledRES
}
createZset(rdb, ctx, "zset", z)
+ // ZRANDMEMBER key_not_exist
+ nil_reply := rdb.Do(ctx, "ZRANDMEMBER", "key_not_exist").Val()
+ require.Equal(t, redis.Nil, nil_reply)
Review Comment:
```suggestion
nilReply := rdb.Do(ctx, "ZRANDMEMBER", "key_not_exist").Val()
require.Equal(t, redis.Nil, nilReply)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(zset): crash in ZRANDMEMBER for non-existent keys [kvrocks]
Posted by "PragmaTwice (via GitHub)" <gi...@apache.org>.
PragmaTwice commented on code in PR #2982:
URL: https://github.com/apache/kvrocks/pull/2982#discussion_r2085908347
##########
tests/gocase/unit/type/zset/zset_test.go:
##########
@@ -1324,6 +1324,10 @@ func basicTests(t *testing.T, rdb *redis.Client, ctx context.Context, enabledRES
}
createZset(rdb, ctx, "zset", z)
+ // ZRANDMEMBER key_not_exist
+ nilReply := rdb.Do(ctx, "ZRANDMEMBER", "key_not_exist").Val()
+ require.Equal(t, redis.Nil, nilReply)
Review Comment:
```suggestion
require.Equal(t, nil, nilReply)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(zset): crash in ZRANDMEMBER for non-existent keys [kvrocks]
Posted by "PragmaTwice (via GitHub)" <gi...@apache.org>.
PragmaTwice commented on code in PR #2982:
URL: https://github.com/apache/kvrocks/pull/2982#discussion_r2085870099
##########
tests/gocase/unit/type/zset/zset_test.go:
##########
@@ -1324,8 +1324,12 @@ func basicTests(t *testing.T, rdb *redis.Client, ctx context.Context, enabledRES
}
createZset(rdb, ctx, "zset", z)
+ // ZRANDMEMBER key_not_exist
+ str := rdb.Do(ctx, "ZRANDMEMBER", "key_not_exist").Val()
+ require.Equal(t, redis.Nil, str.(string))
+
// ZRANDMEMBER zset
- str := rdb.Do(ctx, "ZRANDMEMBER", "zset").Val()
+ str = rdb.Do(ctx, "ZRANDMEMBER", "zset").Val()
Review Comment:
```suggestion
str := rdb.Do(ctx, "ZRANDMEMBER", "zset").Val()
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(zset): crash in ZRANDMEMBER for non-existent keys [kvrocks]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #2982:
URL: https://github.com/apache/kvrocks/pull/2982#issuecomment-2875166894
## [](https://sonarcloud.io/dashboard?id=apache_kvrocks&pullRequest=2982) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_kvrocks&pullRequest=2982&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_kvrocks&pullRequest=2982&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_kvrocks&pullRequest=2982&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [100.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_kvrocks&pullRequest=2982&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_kvrocks&pullRequest=2982&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_kvrocks&pullRequest=2982)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(zset): crash in ZRANDMEMBER for non-existent keys [kvrocks]
Posted by "PragmaTwice (via GitHub)" <gi...@apache.org>.
PragmaTwice commented on code in PR #2982:
URL: https://github.com/apache/kvrocks/pull/2982#discussion_r2084062489
##########
tests/gocase/unit/type/zset/zset_test.go:
##########
@@ -1324,6 +1324,10 @@ func basicTests(t *testing.T, rdb *redis.Client, ctx context.Context, enabledRES
}
createZset(rdb, ctx, "zset", z)
+ // ZRANDMEMBER key_not_exist
+ str := rdb.Do(ctx, "ZRANDMEMBER", "key_not_exist").Val()
+ require.Equal(t, redis.Nil, str.(string))
+
// ZRANDMEMBER zset
str := rdb.Do(ctx, "ZRANDMEMBER", "zset").Val()
Review Comment:
```suggestion
str = rdb.Do(ctx, "ZRANDMEMBER", "zset").Val()
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(zset): crash in ZRANDMEMBER for non-existent keys [kvrocks]
Posted by "PragmaTwice (via GitHub)" <gi...@apache.org>.
PragmaTwice merged PR #2982:
URL: https://github.com/apache/kvrocks/pull/2982
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(zset): crash in ZRANDMEMBER for non-existent keys [kvrocks]
Posted by "PragmaTwice (via GitHub)" <gi...@apache.org>.
PragmaTwice commented on code in PR #2982:
URL: https://github.com/apache/kvrocks/pull/2982#discussion_r2085870602
##########
tests/gocase/unit/type/zset/zset_test.go:
##########
@@ -1324,6 +1324,10 @@ func basicTests(t *testing.T, rdb *redis.Client, ctx context.Context, enabledRES
}
createZset(rdb, ctx, "zset", z)
+ // ZRANDMEMBER key_not_exist
+ str := rdb.Do(ctx, "ZRANDMEMBER", "key_not_exist").Val()
+ require.Equal(t, redis.Nil, str.(string))
Review Comment:
```suggestion
nil_reply := rdb.Do(ctx, "ZRANDMEMBER", "key_not_exist").Val()
require.Equal(t, redis.Nil, nil_reply)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org