Debian Codegraph @

mysql-test/suite/memcached/t/memc268_w_batch_7.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:11268
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:11268" ],
73 'connect_timeout' => 20,
74 'select_timeout' => 20
75 };
76 #print "Here are the memcached :\n";
77 $val = $memd->set("B","Berlin|Mitte");
78 $val = $memd->get("B");
79 if ($val) { print "$val\n"; }
80 $val = $memd->set("D","Darmstadt|City");
81 $val = $memd->get("D");
82 if ($val) { print "$val\n"; }
83 $memd->disconnect_all;
84 EOF
85 let $wait_condition=SELECT count(*)=1 FROM test.t1 WHERE c1 = 'D';
86 let $wait_timeout=120;
87 --source include/wait_condition.inc
88 --sorted_result
89 SELECT c1,c2,c21 FROM test.t1;
90
91 connection mysqltest1;
92 # With latest checkin, the memcached plugin will automatically commit
93 # transactions when the connection is closed. So we cannot test the
94 # timeout with the memcached connection closed. If there are new ways
95 # to test such, we can re-enable this
96 # --error ER_LOCK_WAIT_TIMEOUT
97 SELECT c1,c2,c21 FROM t1 FOR UPDATE;
98 ROLLBACK;
99
100 connection default;
101 perl;
102 use DBI;
103 use Cache::Memcached;
104 my $memd = new Cache::Memcached {
105 'servers' => [ "127.0.0.1:11268" ],
106 'connect_timeout' => 20,
107 'select_timeout' => 20
108 };
109 print "Here are the memcached results:\n";
110 $val = $memd->add("M","München|Perlach");
111 $val = $memd->get("M");
112 if ($val) { print "$val\n"; }
113 $val = $memd->add("N","Nürnberg|Nord");
114 $val = $memd->get("N");
115 if ($val) { print "$val\n"; }
116 $val = $memd->add("O","Oldenburg|Friesland");
117 $val = $memd->get("O");
118 if ($val) { print "$val\n"; }
119 $memd->disconnect_all;
120 EOF
121 let $wait_condition=SELECT count(*)=1 FROM test.t1 WHERE c1 = 'O';
122 let $wait_timeout=120;
123 --source include/wait_condition.inc
124 --sorted_result
125 SELECT c1,c2,c21 FROM test.t1;
126
127 connection mysqltest1;
128 # With latest checkin, the memcached plugin will automatically commit
129 # transactions when the connection is closed. So we cannot test the
130 # timeout with the memcached connection closed. If there are new ways
131 # to test such, we can re-enable this
132 # --error ER_LOCK_WAIT_TIMEOUT
133 SELECT c1,c2,c21 FROM test.t1 FOR UPDATE;
134 COMMIT;
135
136 connection default;
137 perl;
138 use DBI;
139 use Cache::Memcached;
140 my $memd = new Cache::Memcached {
141 'servers' => [ "127.0.0.1:11268" ],
142 'connect_timeout' => 20,
143 'select_timeout' => 20
144 };
145 print "Here are the memcached results:\n";
146 $val = $memd->replace("G","Gossen|C");
147 if ($val) { print "$val\n"; }
148 $val = $memd->get("G");
149 if ($val) { print "$val\n"; }
150 $val = $memd->replace("F","Frankfurt|S");
151 if ($val) { print "$val\n"; }
152 $val = $memd->get("F");
153 if ($val) { print "$val\n"; }
154 $val = $memd->replace("E","Essen|W");
155 if ($val) { print "$val\n"; }
156 $val = $memd->get("E");
157 if ($val) { print "$val\n"; }
158 $memd->disconnect_all;
159 EOF
160 --sorted_result
161 SELECT c1,c2,c21 FROM test.t1;
162
163 connection mysqltest1;
164 # With latest checkin, the memcached plugin will automatically commit
165 # transactions when the connection is closed. So we cannot test the
166 # timeout with the memcached connection closed. If there are new ways
167 # to test such, we can re-enable this
168 # --error ER_LOCK_WAIT_TIMEOUT
169 --sorted_result
170 SELECT c1,c2,c21 FROM test.t1 FOR UPDATE;
171 DROP TABLE test.t1;
172 COMMIT;
173
174 connection default;
175 disconnect mysqltest1;
176
177 UNINSTALL PLUGIN daemon_memcached;
178 DROP DATABASE innodb_memcache;
179 DROP USER mysqltest1@localhost;
180
181 SET @@global.transaction_isolation= @transaction_isolation;
182 SET @@global.autocommit=@auto_commit;
183 SET @@global.lock_wait_timeout=@lock_wait;
184 SET @@global.innodb_lock_wait_timeout=@innodb_lock_wait;
185 --disable_connect_log