Debian Codegraph @

mysql-test/suite/memcached/t/memc228_mdl_1.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-w-batch-size': unsigned");
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 @transaction_isolation= @@global.transaction_isolation;
13 SET GLOBAL TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
14
15 # Create the memcached tables
16 --disable_query_log
17 source include/memcache_config.inc;
18 --enable_query_log
19
20 INSERT INTO cache_policies VALUES("cache_policy", "innodb_only",
21 "innodb_only", "innodb_only", "innodb_only");
22
23 INSERT INTO config_options VALUES("separator", "|");
24
25 # describe table for memcache
26 INSERT INTO containers VALUES ("desc_t1", "test", "t1",
27 "c1", "c2,c21", "c3", "c4", "c5", "PRIMARY");
28
29 CREATE USER mysqltest1@localhost;
30 CREATE USER mysqltest2@localhost;
31 connect (mysqltest1,localhost,mysqltest1,,);
32 connect (mysqltest2,localhost,mysqltest2,,);
33 connection mysqltest1;
34 USE test;
35
36 --disable_warnings
37 DROP TABLE IF EXISTS t1;
38 --enable_warnings
39 CREATE TABLE t1 (c1 VARCHAR(32),
40 c2 VARCHAR(1024),
41 c21 VARCHAR(1024),
42 c3 INT, c4 BIGINT UNSIGNED, c5 INT, primary key(c1))
43 ENGINE = INNODB;
44
45 --disable_warnings
46 DROP TABLE IF EXISTS t2;
47 --enable_warnings
48 CREATE TABLE t2 (c1 VARCHAR(32),
49 c2 VARCHAR(255),
50 c21 VARCHAR(255),
51 c3 INT, c4 BIGINT UNSIGNED, c5 INT, primary key(c1))
52 ENGINE = INNODB;
53
54 INSERT INTO t1 VALUES ('D', 'Darmstadt', 'City', 0, 0, 0);
55 INSERT INTO t1 VALUES ('B', 'Berlin', 'Mitte', 0, 0, 0);
56 INSERT INTO t1 VALUES ('C', 'Cottbus', 'West', 0, 0 ,0);
57 INSERT INTO t1 VALUES ('H', 'Hamburg', 'Norderstedt', 0, 0, 0);
58
59 INSERT INTO t2 VALUES ('D', 'Darmstadt', 'City', 0, 0, 0);
60 INSERT INTO t2 VALUES ('B', 'Berlin', 'Mitte', 0, 0, 0);
61 INSERT INTO t2 VALUES ('C', 'Cottbus', 'West', 0, 0 ,0);
62 INSERT INTO t2 VALUES ('H', 'Hamburg', 'Norderstedt', 0, 0, 0);
63
64 # Tables must exist before plugin can be started!
65 connection default;
66 --let $memcached_address=127.0.0.1:11228
67 --source ../include/load_daemon_memcached_expecting_success.inc
68
69 connection mysqltest2;
70 USE test;
71 --sorted_result
72 SELECT c1,c2,c21 FROM t1;
73
74 connection mysqltest1;
75 echo send DROP TABLE IF EXISTS t1;
76 send DROP TABLE IF EXISTS t1;
77 sleep 2;
78 perl;
79 use DBI;
80 use Cache::Memcached;
81 my $memd = new Cache::Memcached {
82 'servers' => [ "127.0.0.1:11228" ],
83 'connect_timeout' => 20,
84 'select_timeout' => 20
85 };
86 print "Here are the memcached results with D,B,H,C:\n";
87 $val = $memd->get("D");
88 if ($val) { print "$val\n"; }
89 $val = $memd->get("B");
90 if ($val) { print "$val\n"; }
91 $val = $memd->get("H");
92 if ($val) { print "$val\n"; }
93 $val = $memd->get("C");
94 if ($val) { print "$val\n"; }
95 $memd->disconnect_all;
96 EOF
97
98 connection mysqltest2;
99 --error ER_NO_SUCH_TABLE
100 SELECT c1,c2,c21 FROM t1;
101
102 connection mysqltest1;
103 perl;
104 use DBI;
105 use Cache::Memcached;
106 my $memd = new Cache::Memcached {
107 'servers' => [ "127.0.0.1:11228" ],
108 'connect_timeout' => 20,
109 'select_timeout' => 20
110 };
111 print "Here are the memcached results after set:\n";
112 $val = $memd->set("E","Essen|Ost");
113 $val = $memd->get("E");
114 if ($val) { print "$val\n"; }
115 $memd->disconnect_all;
116 EOF
117
118 perl;
119 use DBI;
120 use Cache::Memcached;
121 my $memd = new Cache::Memcached {
122 'servers' => [ "127.0.0.1:11228" ],
123 'connect_timeout' => 20,
124 'select_timeout' => 20
125 };
126 print "Here are the memcached results after add:\n";
127 $val = $memd->add("F","Frankfurt|Sachsenhause");
128 $val = $memd->get("F");
129 if ($val) { print "$val\n"; }
130 $memd->disconnect_all;
131 EOF
132
133 perl;
134 use DBI;
135 use Cache::Memcached;
136 my $memd = new Cache::Memcached {
137 'servers' => [ "127.0.0.1:11228" ],
138 'connect_timeout' => 20,
139 'select_timeout' => 20
140 };
141 print "Here are the memcached results after replace:\n";
142 $val = $memd->replace("F","Frankfurt a. M.|Sachsenhausen");
143 $val = $memd->get("F");
144 if ($val) { print "$val\n"; }
145 $memd->disconnect_all;
146 EOF
147
148 perl;
149 use DBI;
150 use Cache::Memcached;
151 my $memd = new Cache::Memcached {
152 'servers' => [ "127.0.0.1:11228" ],
153 'connect_timeout' => 20,
154 'select_timeout' => 20
155 };
156 print "Here are the memcached results after delete:\n";
157 $val = $memd->delete("F");
158 $val = $memd->get("F");
159 if ($val) { print "$val\n"; }
160 $memd->disconnect_all;
161 EOF
162
163 perl;
164 use DBI;
165 use Cache::Memcached;
166 my $memd = new Cache::Memcached {
167 'servers' => [ "127.0.0.1:11228" ],
168 'connect_timeout' => 20,
169 'select_timeout' => 20
170 };
171 print "Here are the memcached results after add Frankfurt|:\n";
172 $val = $memd->add("F","Frankfurt|");
173 $val = $memd->get("F");
174 if ($val) { print "$val\n"; }
175 print "Here are the memcached results after add |Airport:\n";
176 $val = $memd->add("F","|");
177 $val = $memd->get("F");
178 if ($val) { print "$val\n"; }
179 $memd->disconnect_all;
180 EOF
181
182 perl;
183 use DBI;
184 use Cache::Memcached;
185 my $memd = new Cache::Memcached {
186 'servers' => [ "127.0.0.1:11228" ],
187 'connect_timeout' => 20,
188 'select_timeout' => 20
189 };
190 print "Here are the memcached results after replace Frankfurt a.M.:\n";
191 $val = $memd->replace("F","Frankfurt a. M.|");
192 $val = $memd->get("F");
193 if ($val) { print "$val\n"; }
194 print "Here are the memcached results after replace Sachsenhausen:\n";
195 $val = $memd->replace("F","|Sachsenhausen");
196 $val = $memd->get("F");
197 if ($val) { print "$val\n"; }
198 $memd->disconnect_all;
199 EOF
200
201 connection mysqltest2;
202 --error ER_NO_SUCH_TABLE
203 SELECT c1,c2,c21 FROM t1;
204
205 connection mysqltest1;
206 echo reap;
207 reap;
208 DROP TABLE t2;
209 connection default;
210 disconnect mysqltest1;
211 disconnect mysqltest2;
212
213 UNINSTALL PLUGIN daemon_memcached;
214 DROP DATABASE innodb_memcache;
215 DROP USER mysqltest1@localhost;
216 DROP USER mysqltest2@localhost;
217
218 SET @@global.transaction_isolation= @transaction_isolation;