summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2012-02-01 18:05:20 -0800
committerdormando <dormando@rydia.net>2012-02-01 18:05:20 -0800
commitc1c99c9f2b37071ee46310735b7a1903aa53193c (patch)
tree91a05bb0624ac294a0aa37d08ecec79e0bf4768f /t
parent5f37a9cd84b24fda97735a59afb347cc11e30579 (diff)
downloadmemcached-c1c99c9f2b37071ee46310735b7a1903aa53193c.tar.gz
fix glitch with flush_all <future>1.4.12
reported by jhpark. items at the bottom of the LRU would be popped for sets if flush_all was set for the "future" but said future hadn't arrived yet. item_get handled this correctly so the flush would not happen, but items at the bottom of the LRU would be reclaimed early. Added tests for this as well.
Diffstat (limited to 't')
-rwxr-xr-xt/flush-all.t16
1 files changed, 14 insertions, 2 deletions
diff --git a/t/flush-all.t b/t/flush-all.t
index e113fc9..b803bb7 100755
--- a/t/flush-all.t
+++ b/t/flush-all.t
@@ -1,7 +1,7 @@
#!/usr/bin/perl
use strict;
-use Test::More tests => 14;
+use Test::More tests => 21;
use FindBin qw($Bin);
use lib "$Bin/lib";
use MemcachedTest;
@@ -40,5 +40,17 @@ is(scalar <$sock>, "OK\r\n", "did flush_all in future");
print $sock "set foo 0 0 4\r\n1234\r\n";
is(scalar <$sock>, "STORED\r\n", "stored foo = '1234'");
mem_get_is($sock, "foo", '1234');
-sleep(2.2);
+sleep(3);
mem_get_is($sock, "foo", undef);
+
+print $sock "set foo 0 0 5\r\n12345\r\n";
+is(scalar <$sock>, "STORED\r\n", "stored foo = '12345'");
+mem_get_is($sock, "foo", '12345');
+print $sock "flush_all 86400\r\n";
+is(scalar <$sock>, "OK\r\n", "did flush_all for far future");
+# Check foo still exists.
+mem_get_is($sock, "foo", '12345');
+print $sock "set foo2 0 0 5\r\n54321\r\n";
+is(scalar <$sock>, "STORED\r\n", "stored foo2 = '54321'");
+mem_get_is($sock, "foo", '12345');
+mem_get_is($sock, "foo2", '54321');