Cluster test: also write from Lua script in resharding test.

This commit is contained in:
antirez 2015-01-09 11:06:38 +01:00
parent da95d22ad2
commit f3fd58eb4a
2 changed files with 13 additions and 2 deletions

View File

@ -66,9 +66,18 @@ test "Cluster consistency during live resharding" {
} }
# Write random data to random list. # Write random data to random list.
set key "key:[randomInt $numkeys]" set listid [randomInt $numkeys]
set key "key:$listid"
set ele [randomValue] set ele [randomValue]
$cluster rpush $key $ele # We write both with Lua scripts and with plain commands.
# This way we are able to stress Lua -> Redis command invocation
# as well, that has tests to prevent Lua to write into wrong
# hash slots.
if {$listid % 2} {
$cluster rpush $key $ele
} else {
$cluster eval {redis.call("rpush",KEYS[1],ARGV[1])} 1 $key $ele
}
lappend content($key) $ele lappend content($key) $ele
if {($j % 1000) == 0} { if {($j % 1000) == 0} {

View File

@ -226,6 +226,8 @@ proc ::redis_cluster::get_keys_from_command {cmd argv} {
# Special handling for other commands # Special handling for other commands
switch -exact $cmd { switch -exact $cmd {
mget {return $argv} mget {return $argv}
eval {return [lrange $argv 2 1+[lindex $argv 1]]}
evalsha {return [lrange $argv 2 1+[lindex $argv 1]]}
} }
# All the remaining commands are not handled. # All the remaining commands are not handled.