Debian Codegraph @

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

raw
1 source include/not_valgrind.inc;
2 source include/have_memcached_plugin.inc;
3 source include/not_windows.inc;
4
5 --disable_query_log
6 CALL mtr.add_suppression("daemon-memcached-r-batch-size': unsigned value");
7 CALL mtr.add_suppression("Could not obtain server's UPN to be used as target service name");
8 CALL mtr.add_suppression("Warning: MySQL is trying to drop");
9 --enable_query_log
10
11 --enable_connect_log
12 SET @auto_commit= @@global.autocommit;
13 SET @@global.autocommit=0;
14 SET @transaction_isolation= @@global.transaction_isolation;
15 SET GLOBAL TRANSACTION ISOLATION LEVEL SERIALIZABLE;
16 SET @lock_wait=@@global.lock_wait_timeout;
17 SET @@global.lock_wait_timeout=1;
18 SET @innodb_lock_wait=@@global.innodb_lock_wait_timeout;
19 SET @@global.innodb_lock_wait_timeout=1;
20
21 # Create the memcached tables
22 --disable_query_log
23 source include/memcache_config.inc;
24 --enable_query_log
25
26 INSERT INTO cache_policies VALUES("cache_policy", "innodb_only",
27 "innodb_only", "innodb_only", "innodb_only");
28
29 INSERT INTO config_options VALUES("separator", "|");
30
31 # describe table for memcache
32 INSERT INTO containers VALUES ("desc_t1", "test", "t1",
33 "c1", "c2,c21", "c3", "c4", "c5", "PRIMARY");
34
35 CREATE USER mysqltest1@localhost;
36 COMMIT;
37 connect (mysqltest1,localhost,mysqltest1,,);
38 connection mysqltest1;
39
40 USE test;
41
42 --disable_warnings
43 DROP TABLE IF EXISTS t1;
44 --enable_warnings
45 CREATE TABLE t1 (c1 VARCHAR(32),
46 c2 VARCHAR(1024),
47 c21 VARCHAR(1024),
48 c3 INT, c4 BIGINT UNSIGNED, c5 INT, primary key(c1))
49 ENGINE = INNODB;
50
51 COMMIT;
52
53 connection default;
54 # Tables must exist before plugin can be started!
55 --let $memcached_address=127.0.0.1:11266
56 --source ../include/load_daemon_memcached_expecting_success.inc
57 SELECT @@global.daemon_memcached_w_batch_size;
58 --error ER_INCORRECT_GLOBAL_LOCAL_VAR
59 SET @@global.daemon_memcached_w_batch_size=100;
60
61 connection mysqltest1;
62
63 --sorted_result
64 SELECT c1,c2,c21 FROM t1;
65 COMMIT;
66
67 connection default;
68 perl;
69 use DBI;
70 use Cache::Memcached;
71 my $memd = new Cache::Memcached {
72 'servers' => [ "127.0.0.1:11266" ],
73 'connect_timeout' => 20,
74 'select_timeout' => 20
75 };
76 #print "Here are the memcached :\n";
77 $val = $memd->set("B","Berlin|Mitte");
78 if ($val) { print "$val\n"; }
79 $val = $memd->set("D","Darmstadt|City");
80 if ($val) { print "$val\n"; }
81 $val = $memd->set("C","Cottbus|Süd");
82 if ($val) { print "$val\n"; }
83 $val = $memd->set("H","Hamburg|Altona");
84 if ($val) { print "$val\n"; }
85 $memd->disconnect_all;
86 EOF
87 --sorted_result
88 SELECT c1,c2,c21 FROM test.t1;
89
90 connection mysqltest1;
91 --sorted_result
92 SELECT c1,c2,c21 FROM t1 FOR UPDATE;
93 ROLLBACK;
94
95 connection default;
96 perl;
97 use DBI;
98 use Cache::Memcached;
99 my $memd = new Cache::Memcached {
100 'servers' => [ "127.0.0.1:11266" ],
101 'connect_timeout' => 20,
102 'select_timeout' => 20
103 };
104 print "Here are the memcached results:\n";
105 $val = $memd->add("M","München|Perlach");
106 if ($val) { print "$val\n"; }
107 $val = $memd->add("N","Nürnberg|Nord");
108 if ($val) { print "$val\n"; }
109 $val = $memd->add("O","Oldenburg|Friesland");
110 if ($val) { print "$val\n"; }
111 $val = $memd->add("S","Stuttgart|Schwaben");
112 if ($val) { print "$val\n"; }
113 $val = $memd->add("G","Gossen|City");
114 if ($val) { print "$val\n"; }
115 $val = $memd->add("F","Frankfurt|Sachsenhausen");
116 if ($val) { print "$val\n"; }
117 $val = $memd->add("E","Essen|West");
118 if ($val) { print "$val\n"; }
119 $val = $memd->add("P","Paderborn|City");
120 if ($val) { print "$val\n"; }
121 $memd->disconnect_all;
122 EOF
123 --sorted_result
124 SELECT c1,c2,c21 FROM test.t1;
125
126 connection mysqltest1;
127 SELECT c1,c2,c21 FROM test.t1 FOR UPDATE;
128 COMMIT;
129
130 connection default;
131 perl;
132 use DBI;
133 use Cache::Memcached;
134 my $memd = new Cache::Memcached {
135 'servers' => [ "127.0.0.1:11266" ],
136 'connect_timeout' => 20,
137 'select_timeout' => 20
138 };
139 print "Here are the memcached results:\n";
140 $val = $memd->replace("G","Gossen|C");
141 if ($val) { print "$val\n"; }
142 $val = $memd->replace("F","Frankfurt|S");
143 if ($val) { print "$val\n"; }
144 $val = $memd->replace("E","Essen|W");
145 if ($val) { print "$val\n"; }
146 $memd->disconnect_all;
147 EOF
148 --sorted_result
149 SELECT SLEEP(2);
150 SELECT c1,c2,c21 FROM test.t1;
151
152 connection mysqltest1;
153 # With latest checkin, the memcached plugin will automatically commit
154 # transactions when you close the connection. So we cannot test the
155 # timeout with the memcached connection closed. If there are new ways
156 # to test such, we can re-enable this
157 # --error ER_LOCK_WAIT_TIMEOUT
158 SELECT c1,c2,c21 FROM test.t1 FOR UPDATE;
159 DROP TABLE test.t1;
160 COMMIT;
161
162 connection default;
163 disconnect mysqltest1;
164
165 UNINSTALL PLUGIN daemon_memcached;
166 DROP DATABASE innodb_memcache;
167 DROP USER mysqltest1@localhost;
168
169 SET @@global.transaction_isolation= @transaction_isolation;
170 SET @@global.autocommit=@auto_commit;
171 SET @@global.lock_wait_timeout=@lock_wait;
172 SET @@global.innodb_lock_wait_timeout=@innodb_lock_wait;