Merge lp:~longbow/percona-server/ps51_kill_idle_trx into lp:percona-server/5.1

Proposed by Valentine Gostev
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
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.

Description of the change

Added innodb_kill_idle_transaction patch and test.

To post a comment you must log in.
Revision history for this message
Stewart Smith (stewart) wrote : Posted in a previous version of this proposal

(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

review: Needs Fixing
Revision history for this message
Oleg Tsarev (tsarev) wrote : Posted in a previous version of this proposal

1) Unnecessary error directive:

198 ++--error 2006 --error CR_SERVER_GONE_ERROR

Enough just a
198 ++--error CR_SERVER_GONE_ERROR

2) SHOW GLOBAL VARIABLES instead of SHOW VARIABLES
248 ++SHOW VARIABLES LIKE 'innodb_kill_idle_transaction';
249 ++SET GLOBAL innodb_kill_idle_transaction=5;

3) Use also SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES ORDER BY Variable_name (not only SHOW GLOBAL VARIABLES)

review: Needs Fixing
Revision history for this message
Oleg Tsarev (tsarev) wrote : Posted in a previous version of this proposal

Please merge two commits to single

review: Needs Fixing
Revision history for this message
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.

Revision history for this message
Oleg Tsarev (tsarev) wrote : Posted in a previous version of this proposal

Where is Jenkins's build URL?

review: Needs Information
Revision history for this message
Oleg Tsarev (tsarev) wrote :

LGTM

review: Approve
Revision history for this message
Stewart Smith (stewart) wrote :
review: Needs Resubmitting
Revision history for this message
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

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
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 #!!! notice !!!
6 # Any small change to this file in the main branch
7 # should be done or reviewed by the maintainer!
8-diff -ruN a/include/mysql/plugin.h b/include/mysql/plugin.h
9---- a/include/mysql/plugin.h 2011-07-07 19:38:24.650374103 +0900
10-+++ b/include/mysql/plugin.h 2011-07-07 19:39:44.611713196 +0900
11+--- a/include/mysql/plugin.h
12++++ b/include/mysql/plugin.h
13 @@ -845,6 +845,12 @@
14 */
15 void thd_set_ha_data(MYSQL_THD thd, const struct handlerton *hton,
16@@ -21,9 +20,8 @@
17 #ifdef __cplusplus
18 }
19 #endif
20-diff -ruN a/include/mysql/plugin.h.pp b/include/mysql/plugin.h.pp
21---- a/include/mysql/plugin.h.pp 2011-07-07 19:38:24.423414787 +0900
22-+++ b/include/mysql/plugin.h.pp 2011-07-07 19:39:44.615372555 +0900
23+--- a/include/mysql/plugin.h.pp
24++++ b/include/mysql/plugin.h.pp
25 @@ -150,3 +150,6 @@
26 void *thd_get_ha_data(const void* thd, const struct handlerton *hton);
27 void thd_set_ha_data(void* thd, const struct handlerton *hton,
28@@ -31,9 +29,8 @@
29 +int thd_command(const void* thd);
30 +long long thd_start_time(const void* thd);
31 +void thd_kill(void* thd);
32-diff -ruN a/sql/sql_class.cc b/sql/sql_class.cc
33---- a/sql/sql_class.cc 2011-07-07 19:38:24.999372326 +0900
34-+++ b/sql/sql_class.cc 2011-07-07 19:39:44.619370533 +0900
35+--- a/sql/sql_class.cc
36++++ b/sql/sql_class.cc
37 @@ -468,6 +468,26 @@
38 return buffer;
39 }
40@@ -61,10 +58,9 @@
41
42 /**
43 Implementation of Drop_table_error_handler::handle_error().
44-diff -ruN a/storage/innodb_plugin/handler/ha_innodb.cc b/storage/innodb_plugin/handler/ha_innodb.cc
45---- a/storage/innodb_plugin/handler/ha_innodb.cc 2011-07-07 19:38:26.162373407 +0900
46-+++ b/storage/innodb_plugin/handler/ha_innodb.cc 2011-07-07 19:39:44.625370650 +0900
47-@@ -2511,6 +2511,10 @@
48+--- a/storage/innodb_plugin/handler/ha_innodb.cc
49++++ b/storage/innodb_plugin/handler/ha_innodb.cc
50+@@ -2521,6 +2521,10 @@
51
52 innobase_commit_concurrency_init_default();
53
54@@ -75,7 +71,7 @@
55 /* Since we in this module access directly the fields of a trx
56 struct, and due to different headers and flags it might happen that
57 mutex_t has a different size in this module and in InnoDB
58-@@ -11237,6 +11241,48 @@
59+@@ -11247,6 +11251,48 @@
60 return(false);
61 }
62
63@@ -124,7 +120,7 @@
64 static SHOW_VAR innodb_status_variables_export[]= {
65 {"Innodb", (char*) &show_innodb_vars, SHOW_FUNC},
66 {NullS, NullS, SHOW_LONG}
67-@@ -11480,6 +11526,15 @@
68+@@ -11500,6 +11546,15 @@
69 "Number of times a thread is allowed to enter InnoDB within the same SQL query after it has once got the ticket",
70 NULL, NULL, 500L, 1L, ~0L, 0);
71
72@@ -140,7 +136,7 @@
73 static MYSQL_SYSVAR_LONG(file_io_threads, innobase_file_io_threads,
74 PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY | PLUGIN_VAR_NOSYSVAR,
75 "Number of file I/O threads in InnoDB.",
76-@@ -11762,6 +11817,7 @@
77+@@ -11784,6 +11839,7 @@
78 MYSQL_SYSVAR(fast_checksum),
79 MYSQL_SYSVAR(commit_concurrency),
80 MYSQL_SYSVAR(concurrency_tickets),
81@@ -148,10 +144,9 @@
82 MYSQL_SYSVAR(data_file_path),
83 MYSQL_SYSVAR(doublewrite_file),
84 MYSQL_SYSVAR(data_home_dir),
85-diff -ruN a/storage/innodb_plugin/include/srv0srv.h b/storage/innodb_plugin/include/srv0srv.h
86---- a/storage/innodb_plugin/include/srv0srv.h 2011-07-07 19:38:26.128372970 +0900
87-+++ b/storage/innodb_plugin/include/srv0srv.h 2011-07-07 19:39:44.646824971 +0900
88-@@ -281,6 +281,7 @@
89+--- a/storage/innodb_plugin/include/srv0srv.h
90++++ b/storage/innodb_plugin/include/srv0srv.h
91+@@ -284,6 +284,7 @@
92 extern ulint srv_activity_count;
93 extern ulint srv_fatal_semaphore_wait_threshold;
94 extern ulint srv_dml_needed_delay;
95@@ -159,9 +154,8 @@
96
97 extern mutex_t* kernel_mutex_temp;/* mutex protecting the server, trx structs,
98 query threads, and lock table: we allocate
99-diff -ruN a/storage/innodb_plugin/include/trx0trx.h b/storage/innodb_plugin/include/trx0trx.h
100---- a/storage/innodb_plugin/include/trx0trx.h 2011-07-07 19:38:25.705377859 +0900
101-+++ b/storage/innodb_plugin/include/trx0trx.h 2011-07-07 19:39:44.650304314 +0900
102+--- a/storage/innodb_plugin/include/trx0trx.h
103++++ b/storage/innodb_plugin/include/trx0trx.h
104 @@ -600,6 +600,8 @@
105 ulint mysql_process_no;/* since in Linux, 'top' reports
106 process id's and not thread id's, we
107@@ -171,9 +165,8 @@
108 /*------------------------------*/
109 ulint n_mysql_tables_in_use; /* number of Innobase tables
110 used in the processing of the current
111-diff -ruN a/storage/innodb_plugin/srv/srv0srv.c b/storage/innodb_plugin/srv/srv0srv.c
112---- a/storage/innodb_plugin/srv/srv0srv.c 2011-07-07 19:38:26.147372081 +0900
113-+++ b/storage/innodb_plugin/srv/srv0srv.c 2011-07-07 19:39:44.658303810 +0900
114+--- a/storage/innodb_plugin/srv/srv0srv.c
115++++ b/storage/innodb_plugin/srv/srv0srv.c
116 @@ -86,6 +86,11 @@
117 #include "trx0i_s.h"
118 #include "os0sync.h" /* for HAVE_ATOMIC_BUILTINS */
119@@ -196,7 +189,7 @@
120 /* How much data manipulation language (DML) statements need to be delayed,
121 in microseconds, in order to reduce the lagging of the purge thread. */
122 UNIV_INTERN ulint srv_dml_needed_delay = 0;
123-@@ -2549,6 +2557,36 @@
124+@@ -2554,6 +2562,36 @@
125 old_sema = sema;
126 }
127
128@@ -233,9 +226,8 @@
129 /* Flush stderr so that a database user gets the output
130 to possible MySQL error file */
131
132-diff -ruN a/storage/innodb_plugin/trx/trx0trx.c b/storage/innodb_plugin/trx/trx0trx.c
133---- a/storage/innodb_plugin/trx/trx0trx.c 2011-07-07 19:38:25.723372433 +0900
134-+++ b/storage/innodb_plugin/trx/trx0trx.c 2011-07-07 19:39:44.665304098 +0900
135+--- a/storage/innodb_plugin/trx/trx0trx.c
136++++ b/storage/innodb_plugin/trx/trx0trx.c
137 @@ -137,6 +137,9 @@
138 trx->mysql_relay_log_file_name = "";
139 trx->mysql_relay_log_pos = 0;
140@@ -246,3 +238,165 @@
141 mutex_create(&trx->undo_mutex, SYNC_TRX_UNDO);
142
143 trx->rseg = NULL;
144+--- /dev/null
145++++ b/mysql-test/r/percona_innodb_kill_idle_trx.result
146+@@ -0,0 +1,41 @@
147++DROP TABLE IF EXISTS t1;
148++SET autocommit=0;
149++CREATE TABLE t1 (a INT) ENGINE=InnoDB;
150++SHOW GLOBAL VARIABLES LIKE 'innodb_kill_idle_transaction';
151++Variable_name Value
152++innodb_kill_idle_transaction 0
153++SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_kill_idle_transaction';
154++VARIABLE_NAME VARIABLE_VALUE
155++INNODB_KILL_IDLE_TRANSACTION 0
156++SET GLOBAL innodb_kill_idle_transaction=1;
157++SHOW GLOBAL VARIABLES LIKE 'innodb_kill_idle_transaction';
158++Variable_name Value
159++innodb_kill_idle_transaction 1
160++SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_kill_idle_transaction';
161++VARIABLE_NAME VARIABLE_VALUE
162++INNODB_KILL_IDLE_TRANSACTION 1
163++BEGIN;
164++INSERT INTO t1 VALUES (1),(2),(3);
165++COMMIT;
166++SELECT * FROM t1;
167++a
168++1
169++2
170++3
171++BEGIN;
172++INSERT INTO t1 VALUES (4),(5),(6);
173++SELECT * FROM t1;
174++ERROR HY000: MySQL server has gone away
175++SELECT * FROM t1;
176++a
177++1
178++2
179++3
180++DROP TABLE t1;
181++SET GLOBAL innodb_kill_idle_transaction=0;
182++SHOW GLOBAL VARIABLES LIKE 'innodb_kill_idle_transaction';
183++Variable_name Value
184++innodb_kill_idle_transaction 0
185++SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_kill_idle_transaction';
186++VARIABLE_NAME VARIABLE_VALUE
187++INNODB_KILL_IDLE_TRANSACTION 0
188+--- /dev/null
189++++ b/mysql-test/t/percona_innodb_kill_idle_trx.test
190+@@ -0,0 +1,28 @@
191++--source include/have_innodb.inc
192++--disable_warnings
193++DROP TABLE IF EXISTS t1;
194++--enable_warnings
195++
196++SET autocommit=0;
197++CREATE TABLE t1 (a INT) ENGINE=InnoDB;
198++
199++--source include/percona_innodb_kill_idle_trx_show.inc
200++SET GLOBAL innodb_kill_idle_transaction=1;
201++--source include/percona_innodb_kill_idle_trx_show.inc
202++
203++BEGIN;
204++INSERT INTO t1 VALUES (1),(2),(3);
205++COMMIT;
206++SELECT * FROM t1;
207++
208++BEGIN;
209++INSERT INTO t1 VALUES (4),(5),(6);
210++sleep 3;
211++
212++--enable_reconnect
213++--error 2006 --error CR_SERVER_GONE_ERROR
214++SELECT * FROM t1;
215++SELECT * FROM t1;
216++DROP TABLE t1;
217++SET GLOBAL innodb_kill_idle_transaction=0;
218++--source include/percona_innodb_kill_idle_trx_show.inc
219+--- /dev/null
220++++ b/mysql-test/r/percona_innodb_kill_idle_trx_locks.result
221+@@ -0,0 +1,45 @@
222++DROP TABLE IF EXISTS t1;
223++SET autocommit=0;
224++CREATE TABLE t1 (a INT) ENGINE=InnoDB;
225++SHOW GLOBAL VARIABLES LIKE 'innodb_kill_idle_transaction';
226++Variable_name Value
227++innodb_kill_idle_transaction 0
228++SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_kill_idle_transaction';
229++VARIABLE_NAME VARIABLE_VALUE
230++INNODB_KILL_IDLE_TRANSACTION 0
231++SET GLOBAL innodb_kill_idle_transaction=5;
232++SHOW GLOBAL VARIABLES LIKE 'innodb_kill_idle_transaction';
233++Variable_name Value
234++innodb_kill_idle_transaction 5
235++SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_kill_idle_transaction';
236++VARIABLE_NAME VARIABLE_VALUE
237++INNODB_KILL_IDLE_TRANSACTION 5
238++BEGIN;
239++INSERT INTO t1 VALUES (1),(2),(3);
240++COMMIT;
241++SELECT * FROM t1;
242++a
243++1
244++2
245++3
246++### Locking rows. Lock should be released when idle trx is killed.
247++BEGIN;
248++SELECT * FROM t1 FOR UPDATE;
249++a
250++1
251++2
252++3
253++UPDATE t1 set a=4;
254++SELECT * FROM t1;
255++a
256++4
257++4
258++4
259++DROP TABLE t1;
260++SET GLOBAL innodb_kill_idle_transaction=0;
261++SHOW GLOBAL VARIABLES LIKE 'innodb_kill_idle_transaction';
262++Variable_name Value
263++innodb_kill_idle_transaction 0
264++SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_kill_idle_transaction';
265++VARIABLE_NAME VARIABLE_VALUE
266++INNODB_KILL_IDLE_TRANSACTION 0
267+--- /dev/null
268++++ b/mysql-test/t/percona_innodb_kill_idle_trx_locks.test
269+@@ -0,0 +1,31 @@
270++--source include/have_innodb.inc
271++--disable_warnings
272++DROP TABLE IF EXISTS t1;
273++--enable_warnings
274++
275++SET autocommit=0;
276++CREATE TABLE t1 (a INT) ENGINE=InnoDB;
277++
278++--source include/percona_innodb_kill_idle_trx_show.inc
279++SET GLOBAL innodb_kill_idle_transaction=5;
280++--source include/percona_innodb_kill_idle_trx_show.inc
281++
282++connect (conn1,localhost,root,,);
283++connection conn1;
284++
285++BEGIN;
286++INSERT INTO t1 VALUES (1),(2),(3);
287++COMMIT;
288++SELECT * FROM t1;
289++
290++--echo ### Locking rows. Lock should be released when idle trx is killed.
291++BEGIN;
292++SELECT * FROM t1 FOR UPDATE;
293++
294++connection default;
295++UPDATE t1 set a=4;
296++
297++SELECT * FROM t1;
298++DROP TABLE t1;
299++SET GLOBAL innodb_kill_idle_transaction=0;
300++--source include/percona_innodb_kill_idle_trx_show.inc
301+--- /dev/null
302++++ b/mysql-test/include/percona_innodb_kill_idle_trx_show.inc
303+@@ -0,0 +1,2 @@
304++SHOW GLOBAL VARIABLES LIKE 'innodb_kill_idle_transaction';
305++SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_kill_idle_transaction';
306
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 bug813587.patch
312 innodb_bug47167_test_fix.patch
313 disable_query_cache_28249_test_sporadic_failure.patch
314+innodb_kill_idle_transaction.patch

Subscribers

People subscribed via source and target branches