mirror of
https://github.com/fluencelabs/redis
synced 2025-03-30 22:31:03 +00:00
ZRANK stress tester
This commit is contained in:
parent
912b9165a9
commit
3589e1a7e5
@ -101,6 +101,7 @@ static struct redisCommand cmdTable[] = {
|
|||||||
{"zrem",3,REDIS_CMD_BULK},
|
{"zrem",3,REDIS_CMD_BULK},
|
||||||
{"zremrangebyscore",4,REDIS_CMD_INLINE},
|
{"zremrangebyscore",4,REDIS_CMD_INLINE},
|
||||||
{"zrange",-4,REDIS_CMD_INLINE},
|
{"zrange",-4,REDIS_CMD_INLINE},
|
||||||
|
{"zrank",3,REDIS_CMD_BULK},
|
||||||
{"zrangebyscore",-4,REDIS_CMD_INLINE},
|
{"zrangebyscore",-4,REDIS_CMD_INLINE},
|
||||||
{"zcount",4,REDIS_CMD_INLINE},
|
{"zcount",4,REDIS_CMD_INLINE},
|
||||||
{"zrevrange",-4,REDIS_CMD_INLINE},
|
{"zrevrange",-4,REDIS_CMD_INLINE},
|
||||||
|
@ -1528,6 +1528,31 @@ proc main {server port} {
|
|||||||
format $diff
|
format $diff
|
||||||
} {0}
|
} {0}
|
||||||
|
|
||||||
|
test {ZSETs ZRANK augmented skip list stress testing} {
|
||||||
|
set err {}
|
||||||
|
$r del myzset
|
||||||
|
for {set k 0} {$k < 10000} {incr k} {
|
||||||
|
set i [expr {$k%1000}]
|
||||||
|
if {[expr rand()] < .2} {
|
||||||
|
$r zrem myzset $i
|
||||||
|
} else {
|
||||||
|
set score [expr rand()]
|
||||||
|
$r zadd myzset $score $i
|
||||||
|
}
|
||||||
|
set card [$r zcard myzset]
|
||||||
|
if {$card > 0} {
|
||||||
|
set index [randomInt $card]
|
||||||
|
set ele [lindex [$r zrange myzset $index $index] 0]
|
||||||
|
set rank [$r zrank myzset $ele]
|
||||||
|
if {$rank != $index} {
|
||||||
|
set err "$ele RANK is wrong! ($rank != [expr $index+1])"
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
set _ $err
|
||||||
|
} {}
|
||||||
|
|
||||||
foreach fuzztype {binary alpha compr} {
|
foreach fuzztype {binary alpha compr} {
|
||||||
test "FUZZ stresser with data model $fuzztype" {
|
test "FUZZ stresser with data model $fuzztype" {
|
||||||
set err 0
|
set err 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user