Debian Codegraph @

mysql-test/suite/memcached/t/memc218_decr.test

raw
1
2 source include/not_valgrind.inc;
3 source include/have_memcached_plugin.inc;
4 source include/not_windows.inc;
5
6 --disable_query_log
7 CALL mtr.add_suppression("daemon-memcached-w-batch-size': unsigned");
8 CALL mtr.add_suppression("Could not obtain server's UPN to be used as target service name");
9 CALL mtr.add_suppression("Warning: MySQL is trying to drop");
10 --enable_query_log
11
12 --enable_connect_log
13 SET @transaction_isolation= @@global.transaction_isolation;
14 SET GLOBAL TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
15
16 # Create the memcached tables
17 --disable_query_log
18 source include/memcache_config.inc;
19 --enable_query_log
20
21 INSERT INTO cache_policies VALUES("cache_policy", "innodb_only",
22 "innodb_only", "innodb_only", "innodb_only");
23
24 INSERT INTO config_options VALUES("separator", "|");
25
26 # describe table for memcache
27 INSERT INTO containers VALUES ("desc_t1", "test", "t1",
28 "c1", "c2", "c3", "c4", "c5", "PRIMARY");
29
30 USE test;
31
32 --disable_warnings
33 DROP TABLE IF EXISTS t1;
34 --enable_warnings
35 CREATE TABLE t1 (c1 VARCHAR(255),
36 c2 VARCHAR(1024),
37 c3 INT, c4 BIGINT UNSIGNED, c5 INT, primary key(c1))
38 ENGINE = INNODB;
39
40 INSERT INTO t1 VALUES ('1', '10', 0, 0, 0);
41 INSERT INTO t1 VALUES ('2', '20', 0, 0, 0);
42 INSERT INTO t1 VALUES ('3', 'Berlin', 0, 0 ,0);
43 INSERT INTO t1 VALUES ('4', '40', 0, 0, 0);
44
45 # Tables must exist before plugin can be started!
46 --let $memcached_address=127.0.0.1:11218
47 --source ../include/load_daemon_memcached_expecting_success.inc
48
49 --sorted_result
50 SELECT c1,c2 FROM t1;
51
52 perl;
53 use DBI;
54 use Cache::Memcached;
55 my $memd = new Cache::Memcached {
56 'servers' => [ "127.0.0.1:11218" ],
57 'connect_timeout' => 20,
58 'select_timeout' =>20
59 };
60 print "Here are the memcached results:\n";
61 $val = $memd->get("1");
62 if ($val) { print "$val\n"; }
63 $val = $memd->get("2");
64 if ($val) { print "$val\n"; }
65 $val = $memd->get("3");
66 if ($val) { print "$val\n"; }
67 $val = $memd->get("4");
68 if ($val) { print "$val\n"; }
69 print "Here are the memcached results after decr 4|40:\n";
70 $val = $memd->decr("4");
71 if ($val) { print "$val\n"; }
72 $val = $memd->decr("4","20");
73 if ($val) { print "$val\n"; }
74 $val = $memd->get("4");
75 if ($val) { print "$val\n"; }
76 $val = $memd->decr("3");
77 if ($val) { print "$val\n"; }
78 $val = $memd->decr("3","Bern");
79 if ($val) { print "$val\n"; }
80 $val = $memd->decr("8","1");
81 if ($val) { print "$val\n"; }
82 $memd->disconnect_all;
83 EOF
84
85 --sorted_result
86 SELECT c1,c2 FROM t1;
87
88 DROP TABLE IF EXISTS t1;
89
90 UNINSTALL PLUGIN daemon_memcached;
91 DROP DATABASE innodb_memcache;
92
93 SET @@global.transaction_isolation= @transaction_isolation;