fix zslGetRank bug in dead-code (#9246)
This fixes an issue with zslGetRank which will happen only if the skiplist data stracture is added two entries with the same element name, this can't happen in redis zsets (we use dict), but in theory this is a bug in the underlaying skiplist code. Fixes #3081 and #4032 Co-authored-by: minjian.cai <cmjgithub@163.com>
This commit is contained in:
+1
-1
@@ -488,7 +488,7 @@ unsigned long zslGetRank(zskiplist *zsl, double score, sds ele) {
|
||||
}
|
||||
|
||||
/* x might be equal to zsl->header, so test if obj is non-NULL */
|
||||
if (x->ele && sdscmp(x->ele,ele) == 0) {
|
||||
if (x->ele && x->score == score && sdscmp(x->ele,ele) == 0) {
|
||||
return rank;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user