Debian Codegraph @

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

raw
1 source include/not_valgrind.inc;
2 source include/have_memcached_plugin.inc;
3 source include/not_windows.inc;
4
5 # This is a test on max daemon_memcached_w_batch_size configure option (1048576)
6 # The read configure option daemon_memcached_r_batch_size is also configured
7 # to 1048576. This means the transaction never commits
8 --disable_query_log
9 CALL mtr.add_suppression("daemon-memcached-r-batch-size': unsigned value");
10 CALL mtr.add_suppression("Could not obtain server's UPN to be used as target service name");
11 CALL mtr.add_suppression("Warning: MySQL is trying to drop");
12 --enable_query_log
13
14 --enable_connect_log
15 SET @auto_commit= @@global.autocommit;
16 SET @@global.autocommit=0;
17 SET @transaction_isolation= @@global.transaction_isolation;
18 SET GLOBAL TRANSACTION ISOLATION LEVEL SERIALIZABLE;
19 SET @lock_wait=@@global.lock_wait_timeout;
20 SET @@global.lock_wait_timeout=1;
21 SET @innodb_lock_wait=@@global.innodb_lock_wait_timeout;
22 SET @@global.innodb_lock_wait_timeout=1;
23
24 # Create the memcached tables
25 --disable_query_log
26 source include/memcache_config.inc;
27 --enable_query_log
28
29 INSERT INTO cache_policies VALUES("cache_policy", "innodb_only",
30 "innodb_only", "innodb_only", "innodb_only");
31
32 INSERT INTO config_options VALUES("separator", "|");
33
34 # describe table for memcache
35 INSERT INTO containers VALUES ("desc_t1", "test", "t1",
36 "c1", "c2,c21", "c3", "c4", "c5", "PRIMARY");
37 COMMIT;
38
39 CREATE USER mysqltest1@localhost;
40 COMMIT;
41 connect (mysqltest1,localhost,mysqltest1,,);
42 connection mysqltest1;
43
44 USE test;
45
46 --disable_warnings
47 DROP TABLE IF EXISTS t1;
48 --enable_warnings
49 CREATE TABLE t1 (c1 VARCHAR(32),
50 c2 TEXT,
51 c21 TEXT,
52 c3 INT, c4 BIGINT UNSIGNED, c5 INT, primary key(c1))
53 ENGINE = INNODB;
54
55 INSERT INTO t1 VALUES("Z", REPEAT("a", 15000), REPEAT("b", 1000), 0, 0, 0);
56 COMMIT;
57
58 connection default;
59 # Tables must exist before plugin can be started!
60 --let $memcached_address=127.0.0.1:11251
61 --source ../include/load_daemon_memcached_expecting_success.inc
62 SELECT @@global.daemon_memcached_w_batch_size;
63 --error ER_INCORRECT_GLOBAL_LOCAL_VAR
64 SET @@global.daemon_memcached_w_batch_size=100;
65
66 connection default;
67 perl;
68 use DBI;
69 use Cache::Memcached;
70 my $memd = new Cache::Memcached {
71 'servers' => [ "127.0.0.1:11251" ],
72 'connect_timeout' => 20,
73 'select_timeout' => 20
74 };
75 #print "Here are the memcached :\n";
76 $val = $memd->set("B","Berlin|Mitte");
77 $val = $memd->get("B");
78 if ($val) { print "$val\n"; }
79 $val = $memd->set("D","Darmstadt|City");
80 $val = $memd->get("D");
81 if ($val) { print "$val\n"; }
82 $val = $memd->get("Z");
83 if ($val) { print "$val\n"; }
84 $memd->disconnect_all;
85 EOF
86
87 --sorted_result
88 SELECT c1 FROM test.t1;
89
90 connection mysqltest1;
91 # With latest checkin, the memcached plugin will automatically commit
92 # transactions when the connection is closed. So we cannot test the
93 # timeout with the memcached connection closed. If there are new ways
94 # to test such, we can re-enable this
95 # --error ER_LOCK_WAIT_TIMEOUT
96 SELECT c1 FROM t1 FOR UPDATE;
97 COMMIT;
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:11251" ],
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
119 #It will not be able to see values added by other session
120 $val = $memd->get("D");
121 if ($val) { print "$val\n"; }
122 $memd->disconnect_all;
123 EOF
124 --sorted_result
125 SELECT c1 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:11251" ],
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 FROM test.t1;
162
163 connection default;
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 SELECT c1,c2,c21 FROM test.t1 FOR UPDATE;
170
171 DROP TABLE test.t1;
172
173 connection default;
174 disconnect mysqltest1;
175
176 UNINSTALL PLUGIN daemon_memcached;
177 DROP DATABASE innodb_memcache;
178 DROP USER mysqltest1@localhost;
179
180 SET @@global.transaction_isolation= @transaction_isolation;
181 SET @@global.autocommit=@auto_commit;
182 SET @@global.lock_wait_timeout=@lock_wait;
183 SET @@global.innodb_lock_wait_timeout=@innodb_lock_wait;