Debian Codegraph @

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