22
33use strict;
44use warnings;
5- use Test::More tests => 11 ;
5+ use Test::More tests => 12 ;
66use FindBin qw( $Bin) ;
77use lib " $Bin /lib" ;
88use MemcachedTest;
@@ -12,25 +12,23 @@ my $server = new_memcached('-m 60 -o slab_reassign,slab_automove,lru_crawler,lru
1212my $sock = $server -> sock;
1313
1414my $value = " B" x 11000 ;
15- my $keycount = 5750 ;
15+ my $keycount = 6000 ;
1616
1717my $res ;
1818for (1 .. $keycount ) {
1919 print $sock " set nfoo$_ 0 0 11000 noreply\r\n $value \r\n " ;
2020}
2121
22- my $todelete = 0;
2322{
2423 my $stats = mem_stats($sock );
2524 cmp_ok($stats -> {curr_items }, ' >' , 4000, " stored at least 4000 11k items" );
26- $todelete = $stats -> {curr_items };
27- # for ('evictions', 'reclaimed', 'curr_items', 'cmd_set', 'bytes') {
28- # print STDERR "$_: ", $stats->{$_}, "\n";
29- # }
25+ # for ('evictions', 'reclaimed', 'curr_items', 'cmd_set', 'bytes') {
26+ # diag "$_: ", $stats->{$_}, "\n";
27+ # }
3028}
3129
3230# Make room in old class so rescues can happen when we switch slab classes.
33- for (1 .. $todelete ) {
31+ for (1 .. $keycount ) {
3432 next unless $_ % 2 == 0;
3533 print $sock " delete nfoo$_ noreply\r\n " ;
3634}
@@ -47,17 +45,21 @@ for (1 .. $todelete) {
4745 cmp_ok($tries , ' >' , 0, ' some pages moved back to global pool' );
4846}
4947
50- $value = " B" x 7000 ;
48+ my $stats_before = mem_stats($sock );
49+
50+ # Ensure we can set data into a different slab class.
51+
52+ $value = " B" x 6000 ;
5153for (1 .. $keycount ) {
52- print $sock " set ifoo$_ 0 0 7000 noreply\r\n $value \r\n " ;
54+ print $sock " set ifoo$_ 0 0 6000 noreply\r\n $value \r\n " ;
5355}
5456
5557my $missing = 0;
5658my $hits = 0;
5759for (1 .. $keycount ) {
5860 print $sock " get ifoo$_ \r\n " ;
5961 my $body = scalar (<$sock >);
60- my $expected = " VALUE ifoo$_ 0 7000 \r\n $value \r\n END\r\n " ;
62+ my $expected = " VALUE ifoo$_ 0 6000 \r\n $value \r\n END\r\n " ;
6163 if ($body =~ / ^END/ ) {
6264 $missing ++;
6365 } else {
@@ -73,7 +75,8 @@ for (1 .. $keycount) {
7375
7476{
7577 my $stats = mem_stats($sock );
76- cmp_ok($stats -> {evictions }, ' <' , 2000, ' evictions were less than 2000' );
78+ cmp_ok($stats -> {evictions } - $stats_before -> {evictions }, ' >' , 0, ' evictions were greater than 0' );
79+ cmp_ok($stats -> {evictions } - $stats_before -> {evictions }, ' <' , 2200, ' evictions were less than 2200' );
7780# for ('evictions', 'reclaimed', 'curr_items', 'cmd_set', 'bytes') {
7881# print STDERR "$_: ", $stats->{$_}, "\n";
7982# }
0 commit comments