Server IP : 172.67.216.182 / Your IP : 172.70.208.157 Web Server : Apache System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /www/server/mysql/src/plugin/innodb_memcached/daemon_memcached/t/ |
Upload File : |
#!/usr/bin/perl use strict; use Test::More tests => 149; use FindBin qw($Bin); use lib "$Bin/lib"; use MemcachedTest; # assuming max slab is 1M and default mem is 64M my $server = new_memcached(); my $sock = $server->sock; # create a big value for the largest slab my $max = 1024 * 1024; my $big = 'x' x (1024 * 1024 - 250); ok(length($big) > 512 * 1024, "buffer is bigger than 512k"); ok(length($big) < 1024 * 1024, "buffer is less than 1m"); # test that an even bigger value is rejected while we're here my $too_big = $big . $big . $big; my $len = length($too_big); print $sock "set too_big 0 0 $len\r\n$too_big\r\n"; is(scalar <$sock>, "SERVER_ERROR object too large for cache\r\n", "too_big not stored"); # set the big value my $len = length($big); print $sock "set big 0 0 $len\r\n$big\r\n"; is(scalar <$sock>, "STORED\r\n", "stored big"); mem_get_is($sock, "big", $big); # no evictions yet my $stats = mem_stats($sock); is($stats->{"evictions"}, "0", "no evictions to start"); # set many big items, enough to get evictions for (my $i = 0; $i < 100; $i++) { print $sock "set item_$i 0 0 $len\r\n$big\r\n"; is(scalar <$sock>, "STORED\r\n", "stored item_$i"); } # some evictions should have happened my $stats = mem_stats($sock); my $evictions = int($stats->{"evictions"}); ok($evictions == 37, "some evictions happened"); # the first big value should be gone mem_get_is($sock, "big", undef); # the earliest items should be gone too for (my $i = 0; $i < $evictions - 1; $i++) { mem_get_is($sock, "item_$i", undef); } # check that the non-evicted are the right ones for (my $i = $evictions - 1; $i < $evictions + 4; $i++) { mem_get_is($sock, "item_$i", $big); }