From 0d36ded040eba3b7b6e6ed1437f4f9c0bd44fbbe Mon Sep 17 00:00:00 2001 From: antirez Date: Tue, 15 Dec 2009 04:06:10 -0500 Subject: [PATCH] Fixed issue #121 --- redis.c | 2 +- test-redis.tcl | 34 ++++++++++++++++++++++++---------- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/redis.c b/redis.c index 98fbe22f..f28b940a 100644 --- a/redis.c +++ b/redis.c @@ -3961,7 +3961,7 @@ static void sinterGenericCommand(redisClient *c, robj **setskeys, unsigned long zfree(dv); if (dstkey) { deleteKey(c->db,dstkey); - addReply(c,shared.ok); + addReply(c,shared.czero); } else { addReply(c,shared.nullmultibulk); } diff --git a/test-redis.tcl b/test-redis.tcl index 162a3b83..751059de 100644 --- a/test-redis.tcl +++ b/test-redis.tcl @@ -52,6 +52,19 @@ proc zlistAlikeSort {a b} { string compare [lindex $a 1] [lindex $b 1] } +proc waitForBgsave r { + while 1 { + set i [$r info] + if {[string match {*bgsave_in_progress:1*} $i]} { + puts -nonewline "\nWaiting for background save to finish... " + flush stdout + after 1000 + } else { + break + } + } +} + proc main {server port} { set r [redis $server $port] $r select 9 @@ -633,16 +646,7 @@ proc main {server port} { test {SAVE - make sure there are all the types as values} { # Wait for a background saving in progress to terminate - while 1 { - set i [$r info] - if {[string match {*bgsave_in_progress:1*} $i]} { - puts -nonewline "\nWaiting for background save to finish... " - flush stdout - after 100 - } else { - break - } - } + waitForBgsave $r $r lpush mysavelist hello $r lpush mysavelist world $r set myemptykey {} @@ -1210,6 +1214,16 @@ proc main {server port} { } {0} } + test {BGSAVE} { + $r flushdb + $r save + $r set x 10 + $r bgsave + waitForBgsave $r + $r debug reload + $r get x + } {10} + # Leave the user with a clean DB before to exit test {FLUSHDB} { set aux {} -- 2.45.2