Merge lp:~longbow/percona-server/ps51_kill_idle_trx into lp:percona-server/5.1
- ps51_kill_idle_trx
- Merge into 5.1
Status: | Rejected |
---|---|
Rejected by: | Stewart Smith |
Proposed branch: | lp:~longbow/percona-server/ps51_kill_idle_trx |
Merge into: | lp:percona-server/5.1 |
Diff against target: |
314 lines (+185/-30) 2 files modified
patches/innodb_kill_idle_transaction.patch (+184/-30) patches/series (+1/-0) |
To merge this branch: | bzr merge lp:~longbow/percona-server/ps51_kill_idle_trx |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Stewart Smith (community) | Needs Resubmitting | ||
Oleg Tsarev (community) | Approve | ||
Review via email: mp+72222@code.launchpad.net |
This proposal supersedes a proposal from 2011-08-19.
Commit message
Description of the change
Added innodb_
Stewart Smith (stewart) wrote : Posted in a previous version of this proposal | # |
Oleg Tsarev (tsarev) wrote : Posted in a previous version of this proposal | # |
1) Unnecessary error directive:
198 ++--error 2006 --error CR_SERVER_
Enough just a
198 ++--error CR_SERVER_
2) SHOW GLOBAL VARIABLES instead of SHOW VARIABLES
248 ++SHOW VARIABLES LIKE 'innodb_
249 ++SET GLOBAL innodb_
3) Use also SELECT * FROM INFORMATION_
Oleg Tsarev (tsarev) wrote : Posted in a previous version of this proposal | # |
Please merge two commits to single
Oleg Tsarev (tsarev) wrote : Posted in a previous version of this proposal | # |
> Please merge two commits to single
Single commit more clear and simpler for search problems/analyse changes, than two.
Thank you.
Oleg Tsarev (tsarev) wrote : Posted in a previous version of this proposal | # |
Where is Jenkins's build URL?
Stewart Smith (stewart) wrote : | # |
https:/
needs same fix as ^ (i.e. there are bugs)
Stewart Smith (stewart) wrote : | # |
This patch has been merged in other commits.
Unmerged revisions
- 279. By longbow <longbow@mil-nb>
-
Added tests for innodb_
kill_idle_ transaction. patch and added patch to series
Preview Diff
1 | === renamed file 'innodb_kill_idle_transaction.patch' => 'patches/innodb_kill_idle_transaction.patch' | |||
2 | --- innodb_kill_idle_transaction.patch 2011-07-07 13:02:19 +0000 | |||
3 | +++ patches/innodb_kill_idle_transaction.patch 2011-08-19 16:57:59 +0000 | |||
4 | @@ -5,9 +5,8 @@ | |||
5 | 5 | #!!! notice !!! | 5 | #!!! notice !!! |
6 | 6 | # Any small change to this file in the main branch | 6 | # Any small change to this file in the main branch |
7 | 7 | # should be done or reviewed by the maintainer! | 7 | # should be done or reviewed by the maintainer! |
11 | 8 | diff -ruN a/include/mysql/plugin.h b/include/mysql/plugin.h | 8 | --- a/include/mysql/plugin.h |
12 | 9 | --- a/include/mysql/plugin.h 2011-07-07 19:38:24.650374103 +0900 | 9 | +++ b/include/mysql/plugin.h |
10 | 10 | +++ b/include/mysql/plugin.h 2011-07-07 19:39:44.611713196 +0900 | ||
13 | 11 | @@ -845,6 +845,12 @@ | 10 | @@ -845,6 +845,12 @@ |
14 | 12 | */ | 11 | */ |
15 | 13 | void thd_set_ha_data(MYSQL_THD thd, const struct handlerton *hton, | 12 | void thd_set_ha_data(MYSQL_THD thd, const struct handlerton *hton, |
16 | @@ -21,9 +20,8 @@ | |||
17 | 21 | #ifdef __cplusplus | 20 | #ifdef __cplusplus |
18 | 22 | } | 21 | } |
19 | 23 | #endif | 22 | #endif |
23 | 24 | diff -ruN a/include/mysql/plugin.h.pp b/include/mysql/plugin.h.pp | 23 | --- a/include/mysql/plugin.h.pp |
24 | 25 | --- a/include/mysql/plugin.h.pp 2011-07-07 19:38:24.423414787 +0900 | 24 | +++ b/include/mysql/plugin.h.pp |
22 | 26 | +++ b/include/mysql/plugin.h.pp 2011-07-07 19:39:44.615372555 +0900 | ||
25 | 27 | @@ -150,3 +150,6 @@ | 25 | @@ -150,3 +150,6 @@ |
26 | 28 | void *thd_get_ha_data(const void* thd, const struct handlerton *hton); | 26 | void *thd_get_ha_data(const void* thd, const struct handlerton *hton); |
27 | 29 | void thd_set_ha_data(void* thd, const struct handlerton *hton, | 27 | void thd_set_ha_data(void* thd, const struct handlerton *hton, |
28 | @@ -31,9 +29,8 @@ | |||
29 | 31 | +int thd_command(const void* thd); | 29 | +int thd_command(const void* thd); |
30 | 32 | +long long thd_start_time(const void* thd); | 30 | +long long thd_start_time(const void* thd); |
31 | 33 | +void thd_kill(void* thd); | 31 | +void thd_kill(void* thd); |
35 | 34 | diff -ruN a/sql/sql_class.cc b/sql/sql_class.cc | 32 | --- a/sql/sql_class.cc |
36 | 35 | --- a/sql/sql_class.cc 2011-07-07 19:38:24.999372326 +0900 | 33 | +++ b/sql/sql_class.cc |
34 | 36 | +++ b/sql/sql_class.cc 2011-07-07 19:39:44.619370533 +0900 | ||
37 | 37 | @@ -468,6 +468,26 @@ | 34 | @@ -468,6 +468,26 @@ |
38 | 38 | return buffer; | 35 | return buffer; |
39 | 39 | } | 36 | } |
40 | @@ -61,10 +58,9 @@ | |||
41 | 61 | 58 | ||
42 | 62 | /** | 59 | /** |
43 | 63 | Implementation of Drop_table_error_handler::handle_error(). | 60 | Implementation of Drop_table_error_handler::handle_error(). |
48 | 64 | diff -ruN a/storage/innodb_plugin/handler/ha_innodb.cc b/storage/innodb_plugin/handler/ha_innodb.cc | 61 | --- a/storage/innodb_plugin/handler/ha_innodb.cc |
49 | 65 | --- a/storage/innodb_plugin/handler/ha_innodb.cc 2011-07-07 19:38:26.162373407 +0900 | 62 | +++ b/storage/innodb_plugin/handler/ha_innodb.cc |
50 | 66 | +++ b/storage/innodb_plugin/handler/ha_innodb.cc 2011-07-07 19:39:44.625370650 +0900 | 63 | @@ -2521,6 +2521,10 @@ |
47 | 67 | @@ -2511,6 +2511,10 @@ | ||
51 | 68 | 64 | ||
52 | 69 | innobase_commit_concurrency_init_default(); | 65 | innobase_commit_concurrency_init_default(); |
53 | 70 | 66 | ||
54 | @@ -75,7 +71,7 @@ | |||
55 | 75 | /* Since we in this module access directly the fields of a trx | 71 | /* Since we in this module access directly the fields of a trx |
56 | 76 | struct, and due to different headers and flags it might happen that | 72 | struct, and due to different headers and flags it might happen that |
57 | 77 | mutex_t has a different size in this module and in InnoDB | 73 | mutex_t has a different size in this module and in InnoDB |
59 | 78 | @@ -11237,6 +11241,48 @@ | 74 | @@ -11247,6 +11251,48 @@ |
60 | 79 | return(false); | 75 | return(false); |
61 | 80 | } | 76 | } |
62 | 81 | 77 | ||
63 | @@ -124,7 +120,7 @@ | |||
64 | 124 | static SHOW_VAR innodb_status_variables_export[]= { | 120 | static SHOW_VAR innodb_status_variables_export[]= { |
65 | 125 | {"Innodb", (char*) &show_innodb_vars, SHOW_FUNC}, | 121 | {"Innodb", (char*) &show_innodb_vars, SHOW_FUNC}, |
66 | 126 | {NullS, NullS, SHOW_LONG} | 122 | {NullS, NullS, SHOW_LONG} |
68 | 127 | @@ -11480,6 +11526,15 @@ | 123 | @@ -11500,6 +11546,15 @@ |
69 | 128 | "Number of times a thread is allowed to enter InnoDB within the same SQL query after it has once got the ticket", | 124 | "Number of times a thread is allowed to enter InnoDB within the same SQL query after it has once got the ticket", |
70 | 129 | NULL, NULL, 500L, 1L, ~0L, 0); | 125 | NULL, NULL, 500L, 1L, ~0L, 0); |
71 | 130 | 126 | ||
72 | @@ -140,7 +136,7 @@ | |||
73 | 140 | static MYSQL_SYSVAR_LONG(file_io_threads, innobase_file_io_threads, | 136 | static MYSQL_SYSVAR_LONG(file_io_threads, innobase_file_io_threads, |
74 | 141 | PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY | PLUGIN_VAR_NOSYSVAR, | 137 | PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY | PLUGIN_VAR_NOSYSVAR, |
75 | 142 | "Number of file I/O threads in InnoDB.", | 138 | "Number of file I/O threads in InnoDB.", |
77 | 143 | @@ -11762,6 +11817,7 @@ | 139 | @@ -11784,6 +11839,7 @@ |
78 | 144 | MYSQL_SYSVAR(fast_checksum), | 140 | MYSQL_SYSVAR(fast_checksum), |
79 | 145 | MYSQL_SYSVAR(commit_concurrency), | 141 | MYSQL_SYSVAR(commit_concurrency), |
80 | 146 | MYSQL_SYSVAR(concurrency_tickets), | 142 | MYSQL_SYSVAR(concurrency_tickets), |
81 | @@ -148,10 +144,9 @@ | |||
82 | 148 | MYSQL_SYSVAR(data_file_path), | 144 | MYSQL_SYSVAR(data_file_path), |
83 | 149 | MYSQL_SYSVAR(doublewrite_file), | 145 | MYSQL_SYSVAR(doublewrite_file), |
84 | 150 | MYSQL_SYSVAR(data_home_dir), | 146 | MYSQL_SYSVAR(data_home_dir), |
89 | 151 | diff -ruN a/storage/innodb_plugin/include/srv0srv.h b/storage/innodb_plugin/include/srv0srv.h | 147 | --- a/storage/innodb_plugin/include/srv0srv.h |
90 | 152 | --- a/storage/innodb_plugin/include/srv0srv.h 2011-07-07 19:38:26.128372970 +0900 | 148 | +++ b/storage/innodb_plugin/include/srv0srv.h |
91 | 153 | +++ b/storage/innodb_plugin/include/srv0srv.h 2011-07-07 19:39:44.646824971 +0900 | 149 | @@ -284,6 +284,7 @@ |
88 | 154 | @@ -281,6 +281,7 @@ | ||
92 | 155 | extern ulint srv_activity_count; | 150 | extern ulint srv_activity_count; |
93 | 156 | extern ulint srv_fatal_semaphore_wait_threshold; | 151 | extern ulint srv_fatal_semaphore_wait_threshold; |
94 | 157 | extern ulint srv_dml_needed_delay; | 152 | extern ulint srv_dml_needed_delay; |
95 | @@ -159,9 +154,8 @@ | |||
96 | 159 | 154 | ||
97 | 160 | extern mutex_t* kernel_mutex_temp;/* mutex protecting the server, trx structs, | 155 | extern mutex_t* kernel_mutex_temp;/* mutex protecting the server, trx structs, |
98 | 161 | query threads, and lock table: we allocate | 156 | query threads, and lock table: we allocate |
102 | 162 | diff -ruN a/storage/innodb_plugin/include/trx0trx.h b/storage/innodb_plugin/include/trx0trx.h | 157 | --- a/storage/innodb_plugin/include/trx0trx.h |
103 | 163 | --- a/storage/innodb_plugin/include/trx0trx.h 2011-07-07 19:38:25.705377859 +0900 | 158 | +++ b/storage/innodb_plugin/include/trx0trx.h |
101 | 164 | +++ b/storage/innodb_plugin/include/trx0trx.h 2011-07-07 19:39:44.650304314 +0900 | ||
104 | 165 | @@ -600,6 +600,8 @@ | 159 | @@ -600,6 +600,8 @@ |
105 | 166 | ulint mysql_process_no;/* since in Linux, 'top' reports | 160 | ulint mysql_process_no;/* since in Linux, 'top' reports |
106 | 167 | process id's and not thread id's, we | 161 | process id's and not thread id's, we |
107 | @@ -171,9 +165,8 @@ | |||
108 | 171 | /*------------------------------*/ | 165 | /*------------------------------*/ |
109 | 172 | ulint n_mysql_tables_in_use; /* number of Innobase tables | 166 | ulint n_mysql_tables_in_use; /* number of Innobase tables |
110 | 173 | used in the processing of the current | 167 | used in the processing of the current |
114 | 174 | diff -ruN a/storage/innodb_plugin/srv/srv0srv.c b/storage/innodb_plugin/srv/srv0srv.c | 168 | --- a/storage/innodb_plugin/srv/srv0srv.c |
115 | 175 | --- a/storage/innodb_plugin/srv/srv0srv.c 2011-07-07 19:38:26.147372081 +0900 | 169 | +++ b/storage/innodb_plugin/srv/srv0srv.c |
113 | 176 | +++ b/storage/innodb_plugin/srv/srv0srv.c 2011-07-07 19:39:44.658303810 +0900 | ||
116 | 177 | @@ -86,6 +86,11 @@ | 170 | @@ -86,6 +86,11 @@ |
117 | 178 | #include "trx0i_s.h" | 171 | #include "trx0i_s.h" |
118 | 179 | #include "os0sync.h" /* for HAVE_ATOMIC_BUILTINS */ | 172 | #include "os0sync.h" /* for HAVE_ATOMIC_BUILTINS */ |
119 | @@ -196,7 +189,7 @@ | |||
120 | 196 | /* How much data manipulation language (DML) statements need to be delayed, | 189 | /* How much data manipulation language (DML) statements need to be delayed, |
121 | 197 | in microseconds, in order to reduce the lagging of the purge thread. */ | 190 | in microseconds, in order to reduce the lagging of the purge thread. */ |
122 | 198 | UNIV_INTERN ulint srv_dml_needed_delay = 0; | 191 | UNIV_INTERN ulint srv_dml_needed_delay = 0; |
124 | 199 | @@ -2549,6 +2557,36 @@ | 192 | @@ -2554,6 +2562,36 @@ |
125 | 200 | old_sema = sema; | 193 | old_sema = sema; |
126 | 201 | } | 194 | } |
127 | 202 | 195 | ||
128 | @@ -233,9 +226,8 @@ | |||
129 | 233 | /* Flush stderr so that a database user gets the output | 226 | /* Flush stderr so that a database user gets the output |
130 | 234 | to possible MySQL error file */ | 227 | to possible MySQL error file */ |
131 | 235 | 228 | ||
135 | 236 | diff -ruN a/storage/innodb_plugin/trx/trx0trx.c b/storage/innodb_plugin/trx/trx0trx.c | 229 | --- a/storage/innodb_plugin/trx/trx0trx.c |
136 | 237 | --- a/storage/innodb_plugin/trx/trx0trx.c 2011-07-07 19:38:25.723372433 +0900 | 230 | +++ b/storage/innodb_plugin/trx/trx0trx.c |
134 | 238 | +++ b/storage/innodb_plugin/trx/trx0trx.c 2011-07-07 19:39:44.665304098 +0900 | ||
137 | 239 | @@ -137,6 +137,9 @@ | 231 | @@ -137,6 +137,9 @@ |
138 | 240 | trx->mysql_relay_log_file_name = ""; | 232 | trx->mysql_relay_log_file_name = ""; |
139 | 241 | trx->mysql_relay_log_pos = 0; | 233 | trx->mysql_relay_log_pos = 0; |
140 | @@ -246,3 +238,165 @@ | |||
141 | 246 | mutex_create(&trx->undo_mutex, SYNC_TRX_UNDO); | 238 | mutex_create(&trx->undo_mutex, SYNC_TRX_UNDO); |
142 | 247 | 239 | ||
143 | 248 | trx->rseg = NULL; | 240 | trx->rseg = NULL; |
144 | 241 | --- /dev/null | ||
145 | 242 | +++ b/mysql-test/r/percona_innodb_kill_idle_trx.result | ||
146 | 243 | @@ -0,0 +1,41 @@ | ||
147 | 244 | +DROP TABLE IF EXISTS t1; | ||
148 | 245 | +SET autocommit=0; | ||
149 | 246 | +CREATE TABLE t1 (a INT) ENGINE=InnoDB; | ||
150 | 247 | +SHOW GLOBAL VARIABLES LIKE 'innodb_kill_idle_transaction'; | ||
151 | 248 | +Variable_name Value | ||
152 | 249 | +innodb_kill_idle_transaction 0 | ||
153 | 250 | +SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_kill_idle_transaction'; | ||
154 | 251 | +VARIABLE_NAME VARIABLE_VALUE | ||
155 | 252 | +INNODB_KILL_IDLE_TRANSACTION 0 | ||
156 | 253 | +SET GLOBAL innodb_kill_idle_transaction=1; | ||
157 | 254 | +SHOW GLOBAL VARIABLES LIKE 'innodb_kill_idle_transaction'; | ||
158 | 255 | +Variable_name Value | ||
159 | 256 | +innodb_kill_idle_transaction 1 | ||
160 | 257 | +SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_kill_idle_transaction'; | ||
161 | 258 | +VARIABLE_NAME VARIABLE_VALUE | ||
162 | 259 | +INNODB_KILL_IDLE_TRANSACTION 1 | ||
163 | 260 | +BEGIN; | ||
164 | 261 | +INSERT INTO t1 VALUES (1),(2),(3); | ||
165 | 262 | +COMMIT; | ||
166 | 263 | +SELECT * FROM t1; | ||
167 | 264 | +a | ||
168 | 265 | +1 | ||
169 | 266 | +2 | ||
170 | 267 | +3 | ||
171 | 268 | +BEGIN; | ||
172 | 269 | +INSERT INTO t1 VALUES (4),(5),(6); | ||
173 | 270 | +SELECT * FROM t1; | ||
174 | 271 | +ERROR HY000: MySQL server has gone away | ||
175 | 272 | +SELECT * FROM t1; | ||
176 | 273 | +a | ||
177 | 274 | +1 | ||
178 | 275 | +2 | ||
179 | 276 | +3 | ||
180 | 277 | +DROP TABLE t1; | ||
181 | 278 | +SET GLOBAL innodb_kill_idle_transaction=0; | ||
182 | 279 | +SHOW GLOBAL VARIABLES LIKE 'innodb_kill_idle_transaction'; | ||
183 | 280 | +Variable_name Value | ||
184 | 281 | +innodb_kill_idle_transaction 0 | ||
185 | 282 | +SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_kill_idle_transaction'; | ||
186 | 283 | +VARIABLE_NAME VARIABLE_VALUE | ||
187 | 284 | +INNODB_KILL_IDLE_TRANSACTION 0 | ||
188 | 285 | --- /dev/null | ||
189 | 286 | +++ b/mysql-test/t/percona_innodb_kill_idle_trx.test | ||
190 | 287 | @@ -0,0 +1,28 @@ | ||
191 | 288 | +--source include/have_innodb.inc | ||
192 | 289 | +--disable_warnings | ||
193 | 290 | +DROP TABLE IF EXISTS t1; | ||
194 | 291 | +--enable_warnings | ||
195 | 292 | + | ||
196 | 293 | +SET autocommit=0; | ||
197 | 294 | +CREATE TABLE t1 (a INT) ENGINE=InnoDB; | ||
198 | 295 | + | ||
199 | 296 | +--source include/percona_innodb_kill_idle_trx_show.inc | ||
200 | 297 | +SET GLOBAL innodb_kill_idle_transaction=1; | ||
201 | 298 | +--source include/percona_innodb_kill_idle_trx_show.inc | ||
202 | 299 | + | ||
203 | 300 | +BEGIN; | ||
204 | 301 | +INSERT INTO t1 VALUES (1),(2),(3); | ||
205 | 302 | +COMMIT; | ||
206 | 303 | +SELECT * FROM t1; | ||
207 | 304 | + | ||
208 | 305 | +BEGIN; | ||
209 | 306 | +INSERT INTO t1 VALUES (4),(5),(6); | ||
210 | 307 | +sleep 3; | ||
211 | 308 | + | ||
212 | 309 | +--enable_reconnect | ||
213 | 310 | +--error 2006 --error CR_SERVER_GONE_ERROR | ||
214 | 311 | +SELECT * FROM t1; | ||
215 | 312 | +SELECT * FROM t1; | ||
216 | 313 | +DROP TABLE t1; | ||
217 | 314 | +SET GLOBAL innodb_kill_idle_transaction=0; | ||
218 | 315 | +--source include/percona_innodb_kill_idle_trx_show.inc | ||
219 | 316 | --- /dev/null | ||
220 | 317 | +++ b/mysql-test/r/percona_innodb_kill_idle_trx_locks.result | ||
221 | 318 | @@ -0,0 +1,45 @@ | ||
222 | 319 | +DROP TABLE IF EXISTS t1; | ||
223 | 320 | +SET autocommit=0; | ||
224 | 321 | +CREATE TABLE t1 (a INT) ENGINE=InnoDB; | ||
225 | 322 | +SHOW GLOBAL VARIABLES LIKE 'innodb_kill_idle_transaction'; | ||
226 | 323 | +Variable_name Value | ||
227 | 324 | +innodb_kill_idle_transaction 0 | ||
228 | 325 | +SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_kill_idle_transaction'; | ||
229 | 326 | +VARIABLE_NAME VARIABLE_VALUE | ||
230 | 327 | +INNODB_KILL_IDLE_TRANSACTION 0 | ||
231 | 328 | +SET GLOBAL innodb_kill_idle_transaction=5; | ||
232 | 329 | +SHOW GLOBAL VARIABLES LIKE 'innodb_kill_idle_transaction'; | ||
233 | 330 | +Variable_name Value | ||
234 | 331 | +innodb_kill_idle_transaction 5 | ||
235 | 332 | +SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_kill_idle_transaction'; | ||
236 | 333 | +VARIABLE_NAME VARIABLE_VALUE | ||
237 | 334 | +INNODB_KILL_IDLE_TRANSACTION 5 | ||
238 | 335 | +BEGIN; | ||
239 | 336 | +INSERT INTO t1 VALUES (1),(2),(3); | ||
240 | 337 | +COMMIT; | ||
241 | 338 | +SELECT * FROM t1; | ||
242 | 339 | +a | ||
243 | 340 | +1 | ||
244 | 341 | +2 | ||
245 | 342 | +3 | ||
246 | 343 | +### Locking rows. Lock should be released when idle trx is killed. | ||
247 | 344 | +BEGIN; | ||
248 | 345 | +SELECT * FROM t1 FOR UPDATE; | ||
249 | 346 | +a | ||
250 | 347 | +1 | ||
251 | 348 | +2 | ||
252 | 349 | +3 | ||
253 | 350 | +UPDATE t1 set a=4; | ||
254 | 351 | +SELECT * FROM t1; | ||
255 | 352 | +a | ||
256 | 353 | +4 | ||
257 | 354 | +4 | ||
258 | 355 | +4 | ||
259 | 356 | +DROP TABLE t1; | ||
260 | 357 | +SET GLOBAL innodb_kill_idle_transaction=0; | ||
261 | 358 | +SHOW GLOBAL VARIABLES LIKE 'innodb_kill_idle_transaction'; | ||
262 | 359 | +Variable_name Value | ||
263 | 360 | +innodb_kill_idle_transaction 0 | ||
264 | 361 | +SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_kill_idle_transaction'; | ||
265 | 362 | +VARIABLE_NAME VARIABLE_VALUE | ||
266 | 363 | +INNODB_KILL_IDLE_TRANSACTION 0 | ||
267 | 364 | --- /dev/null | ||
268 | 365 | +++ b/mysql-test/t/percona_innodb_kill_idle_trx_locks.test | ||
269 | 366 | @@ -0,0 +1,31 @@ | ||
270 | 367 | +--source include/have_innodb.inc | ||
271 | 368 | +--disable_warnings | ||
272 | 369 | +DROP TABLE IF EXISTS t1; | ||
273 | 370 | +--enable_warnings | ||
274 | 371 | + | ||
275 | 372 | +SET autocommit=0; | ||
276 | 373 | +CREATE TABLE t1 (a INT) ENGINE=InnoDB; | ||
277 | 374 | + | ||
278 | 375 | +--source include/percona_innodb_kill_idle_trx_show.inc | ||
279 | 376 | +SET GLOBAL innodb_kill_idle_transaction=5; | ||
280 | 377 | +--source include/percona_innodb_kill_idle_trx_show.inc | ||
281 | 378 | + | ||
282 | 379 | +connect (conn1,localhost,root,,); | ||
283 | 380 | +connection conn1; | ||
284 | 381 | + | ||
285 | 382 | +BEGIN; | ||
286 | 383 | +INSERT INTO t1 VALUES (1),(2),(3); | ||
287 | 384 | +COMMIT; | ||
288 | 385 | +SELECT * FROM t1; | ||
289 | 386 | + | ||
290 | 387 | +--echo ### Locking rows. Lock should be released when idle trx is killed. | ||
291 | 388 | +BEGIN; | ||
292 | 389 | +SELECT * FROM t1 FOR UPDATE; | ||
293 | 390 | + | ||
294 | 391 | +connection default; | ||
295 | 392 | +UPDATE t1 set a=4; | ||
296 | 393 | + | ||
297 | 394 | +SELECT * FROM t1; | ||
298 | 395 | +DROP TABLE t1; | ||
299 | 396 | +SET GLOBAL innodb_kill_idle_transaction=0; | ||
300 | 397 | +--source include/percona_innodb_kill_idle_trx_show.inc | ||
301 | 398 | --- /dev/null | ||
302 | 399 | +++ b/mysql-test/include/percona_innodb_kill_idle_trx_show.inc | ||
303 | 400 | @@ -0,0 +1,2 @@ | ||
304 | 401 | +SHOW GLOBAL VARIABLES LIKE 'innodb_kill_idle_transaction'; | ||
305 | 402 | +SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_kill_idle_transaction'; | ||
306 | 249 | 403 | ||
307 | === modified file 'patches/series' | |||
308 | --- patches/series 2011-08-01 21:45:17 +0000 | |||
309 | +++ patches/series 2011-08-19 16:57:59 +0000 | |||
310 | @@ -60,3 +60,4 @@ | |||
311 | 60 | bug813587.patch | 60 | bug813587.patch |
312 | 61 | innodb_bug47167_test_fix.patch | 61 | innodb_bug47167_test_fix.patch |
313 | 62 | disable_query_cache_28249_test_sporadic_failure.patch | 62 | disable_query_cache_28249_test_sporadic_failure.patch |
314 | 63 | innodb_kill_idle_transaction.patch |
(as mentioned on IRC)
1) decrease sleep
2) create a single patch including tests?
3) on reconnect, do the select again to enuser content of table is correct
4) another test that took row locks (SELECT FOR UPDATE) may be useful to doubly ensure they're released properly