Merge lp:~percona-dev/percona-server/5.1-kill_idle_transaction-innodb_fake_changes into lp:percona-server/5.1

Proposed by Stewart Smith on 2011-10-04
Status: Merged
Approved by: Stewart Smith on 2011-10-04
Approved revision: 282
Merged at revision: 308
Proposed branch: lp:~percona-dev/percona-server/5.1-kill_idle_transaction-innodb_fake_changes
Merge into: lp:percona-server/5.1
Diff against target: 759 lines (+375/-76)
8 files modified
patches/innodb_buffer_pool_shm.patch (+3/-3)
patches/innodb_deadlock_count.patch (+4/-4)
patches/innodb_extend_slow.patch (+1/-1)
patches/innodb_fake_changes.patch (+183/-35)
patches/innodb_fast_shutdown.patch (+8/-8)
patches/innodb_kill_idle_transaction.patch (+173/-24)
patches/innodb_split_buf_pool_mutex.patch (+1/-1)
patches/series (+2/-0)
To merge this branch: bzr merge lp:~percona-dev/percona-server/5.1-kill_idle_transaction-innodb_fake_changes
Reviewer Review Type Date Requested Status
Stewart Smith (community) Approve on 2011-10-04
Review via email: mp+78167@code.launchpad.net

This proposal supersedes a proposal from 2011-09-27.

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

http://jenkins.percona.com/view/Percona%20Server%205.1/job/percona-server-5.1-param/155/

(currently running, may not finish before I hop on the long-haul no-internet flight)

Yasufumi Kinoshita (yasufumi-kinoshita) wrote : Posted in a previous version of this proposal

I don't know how to treat is correct.
It is problem about error handling intention at mysqld.
InnoDB (this patch) is just returning error at ht->commit() at ha_commit_one_phase().

At normal InnoDB, innobase_commit() always returns 0.
So mysqld might not be prepared for retuning error from ha->commit()?

It seems just to avoid the assertion that sandwitched by
"
thd->main_da.can_overwrite_status= TRUE;
...
thd->main_da.can_overwrite_status= FALSE;
"

But I don't know whether it is correct as mysqld intention.

Valentine Gostev (longbow) wrote : Posted in a previous version of this proposal

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'patches/innodb_buffer_pool_shm.patch'
2--- patches/innodb_buffer_pool_shm.patch 2011-09-06 08:23:51 +0000
3+++ patches/innodb_buffer_pool_shm.patch 2011-10-04 21:42:26 +0000
4@@ -42,7 +42,7 @@
5
6 static char* internal_innobase_data_file_path = NULL;
7
8-@@ -2460,6 +2462,12 @@
9+@@ -2468,6 +2470,12 @@
10
11 srv_buf_pool_size = (ulint) innobase_buffer_pool_size;
12
13@@ -55,7 +55,7 @@
14 srv_mem_pool_size = (ulint) innobase_additional_mem_pool_size;
15
16 srv_n_file_io_threads = (ulint) innobase_file_io_threads;
17-@@ -11472,6 +11480,16 @@
18+@@ -11562,6 +11570,16 @@
19 "The size of the memory buffer InnoDB uses to cache data and indexes of its tables.",
20 NULL, NULL, 128*1024*1024L, 32*1024*1024L, LONGLONG_MAX, 1024*1024L);
21
22@@ -72,7 +72,7 @@
23 static MYSQL_SYSVAR_ULONG(commit_concurrency, innobase_commit_concurrency,
24 PLUGIN_VAR_RQCMDARG,
25 "Helps in performance tuning in heavily concurrent environments.",
26-@@ -11760,6 +11778,8 @@
27+@@ -11859,6 +11877,8 @@
28 MYSQL_SYSVAR(additional_mem_pool_size),
29 MYSQL_SYSVAR(autoextend_increment),
30 MYSQL_SYSVAR(buffer_pool_size),
31
32=== modified file 'patches/innodb_deadlock_count.patch'
33--- patches/innodb_deadlock_count.patch 2011-09-06 08:23:51 +0000
34+++ patches/innodb_deadlock_count.patch 2011-10-04 21:42:26 +0000
35@@ -7,7 +7,7 @@
36 # should be done or reviewed by the maintainer!
37 --- a/storage/innodb_plugin/handler/ha_innodb.cc
38 +++ b/storage/innodb_plugin/handler/ha_innodb.cc
39-@@ -566,6 +566,8 @@
40+@@ -572,6 +572,8 @@
41 (char*) &export_vars.innodb_data_written, SHOW_LONG},
42 {"dblwr_pages_written",
43 (char*) &export_vars.innodb_dblwr_pages_written, SHOW_LONG},
44@@ -28,7 +28,7 @@
45 Gets the size of a lock struct.
46 --- a/storage/innodb_plugin/include/srv0srv.h
47 +++ b/storage/innodb_plugin/include/srv0srv.h
48-@@ -689,6 +689,7 @@
49+@@ -690,6 +690,7 @@
50 ulint innodb_buffer_pool_write_requests;/*!< srv_buf_pool_write_requests */
51 ulint innodb_buffer_pool_read_ahead; /*!< srv_read_ahead */
52 ulint innodb_buffer_pool_read_ahead_evicted;/*!< srv_read_ahead evicted*/
53@@ -48,7 +48,7 @@
54 break;
55 --- a/storage/innodb_plugin/srv/srv0srv.c
56 +++ b/storage/innodb_plugin/srv/srv0srv.c
57-@@ -444,7 +444,7 @@
58+@@ -452,7 +452,7 @@
59 static ulint srv_n_rows_updated_old = 0;
60 static ulint srv_n_rows_deleted_old = 0;
61 static ulint srv_n_rows_read_old = 0;
62@@ -57,7 +57,7 @@
63 UNIV_INTERN ulint srv_n_lock_wait_count = 0;
64 UNIV_INTERN ulint srv_n_lock_wait_current_count = 0;
65 UNIV_INTERN ib_int64_t srv_n_lock_wait_time = 0;
66-@@ -2155,6 +2155,8 @@
67+@@ -2163,6 +2163,8 @@
68 = UT_LIST_GET_LEN(buf_pool->flush_list);
69 export_vars.innodb_buffer_pool_pages_free
70 = UT_LIST_GET_LEN(buf_pool->free);
71
72=== modified file 'patches/innodb_extend_slow.patch'
73--- patches/innodb_extend_slow.patch 2011-09-24 20:18:57 +0000
74+++ patches/innodb_extend_slow.patch 2011-10-04 21:42:26 +0000
75@@ -106,7 +106,7 @@
76 @@ -2119,6 +2174,11 @@
77 ibool must_read;
78 ulint retries = 0;
79- mutex_t* block_mutex;
80+ mutex_t* block_mutex = NULL;
81 + trx_t* trx = NULL;
82 + ulint sec;
83 + ulint ms;
84
85=== renamed file 'innodb_fake_changes.patch' => 'patches/innodb_fake_changes.patch'
86--- innodb_fake_changes.patch 2011-07-07 13:02:19 +0000
87+++ patches/innodb_fake_changes.patch 2011-10-04 21:42:26 +0000
88@@ -5,9 +5,8 @@
89 #!!! notice !!!
90 # Any small change to this file in the main branch
91 # should be done or reviewed by the maintainer!
92-diff -ruN a/storage/innodb_plugin/btr/btr0cur.c b/storage/innodb_plugin/btr/btr0cur.c
93---- a/storage/innodb_plugin/btr/btr0cur.c 2011-07-07 19:38:25.840371992 +0900
94-+++ b/storage/innodb_plugin/btr/btr0cur.c 2011-07-07 20:09:02.125335731 +0900
95+--- a/storage/innodb_plugin/btr/btr0cur.c
96++++ b/storage/innodb_plugin/btr/btr0cur.c
97 @@ -1046,6 +1046,11 @@
98 rec_t* rec;
99 roll_ptr_t roll_ptr;
100@@ -179,9 +178,8 @@
101 block = btr_cur_get_block(cursor);
102 rec = btr_cur_get_rec(cursor);
103
104-diff -ruN a/storage/innodb_plugin/handler/ha_innodb.cc b/storage/innodb_plugin/handler/ha_innodb.cc
105---- a/storage/innodb_plugin/handler/ha_innodb.cc 2011-07-07 19:47:22.334541114 +0900
106-+++ b/storage/innodb_plugin/handler/ha_innodb.cc 2011-07-07 20:17:01.737288508 +0900
107+--- a/storage/innodb_plugin/handler/ha_innodb.cc
108++++ b/storage/innodb_plugin/handler/ha_innodb.cc
109 @@ -367,6 +367,12 @@
110 "The value 3 regards innodb_flush_log_at_trx_commit (default).",
111 NULL, NULL, 3, 0, 3, 0);
112@@ -208,11 +206,11 @@
113 trx_search_latch_release_if_reserved(trx);
114 }
115
116-+ if (trx->fake_changes) {
117++ if (trx->fake_changes && (all || (!thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))) {
118 + innobase_rollback(hton, thd, all); /* rollback implicitly */
119++ thd->main_da.reset_diagnostics_area(); /* because debug assertion code complains, if something left */
120 + DBUG_RETURN(HA_ERR_WRONG_COMMAND);
121 + }
122-+
123 /* The flag trx->active_trans is set to 1 in
124
125 1. ::external_lock(),
126@@ -297,9 +295,8 @@
127 NULL
128 };
129
130-diff -ruN a/storage/innodb_plugin/handler/handler0alter.cc b/storage/innodb_plugin/handler/handler0alter.cc
131---- a/storage/innodb_plugin/handler/handler0alter.cc 2011-07-02 00:22:17.000000000 +0900
132-+++ b/storage/innodb_plugin/handler/handler0alter.cc 2011-07-07 20:36:26.885315930 +0900
133+--- a/storage/innodb_plugin/handler/handler0alter.cc
134++++ b/storage/innodb_plugin/handler/handler0alter.cc
135 @@ -652,6 +652,9 @@
136 /* In case MySQL calls this in the middle of a SELECT query, release
137 possible adaptive hash latch to avoid deadlocks of threads. */
138@@ -348,9 +345,8 @@
139 trx_start_if_not_started(trx);
140
141 /* Flag this transaction as a dictionary operation, so that
142-diff -ruN a/storage/innodb_plugin/ibuf/ibuf0ibuf.c b/storage/innodb_plugin/ibuf/ibuf0ibuf.c
143---- a/storage/innodb_plugin/ibuf/ibuf0ibuf.c 2011-07-07 19:38:25.352373413 +0900
144-+++ b/storage/innodb_plugin/ibuf/ibuf0ibuf.c 2011-07-07 20:09:02.137334934 +0900
145+--- a/storage/innodb_plugin/ibuf/ibuf0ibuf.c
146++++ b/storage/innodb_plugin/ibuf/ibuf0ibuf.c
147 @@ -2613,6 +2613,8 @@
148
149 ut_a(trx_sys_multiple_tablespace_format);
150@@ -360,9 +356,8 @@
151 do_merge = FALSE;
152
153 mutex_enter(&ibuf_mutex);
154-diff -ruN a/storage/innodb_plugin/include/trx0trx.h b/storage/innodb_plugin/include/trx0trx.h
155---- a/storage/innodb_plugin/include/trx0trx.h 2011-07-07 19:47:22.348325198 +0900
156-+++ b/storage/innodb_plugin/include/trx0trx.h 2011-07-07 20:09:02.139302150 +0900
157+--- a/storage/innodb_plugin/include/trx0trx.h
158++++ b/storage/innodb_plugin/include/trx0trx.h
159 @@ -509,6 +509,7 @@
160 150 bytes in the undo log size as then
161 we skip XA steps */
162@@ -371,9 +366,8 @@
163 ulint flush_log_later;/* In 2PC, we hold the
164 prepare_commit mutex across
165 both phases. In that case, we
166-diff -ruN a/storage/innodb_plugin/lock/lock0lock.c b/storage/innodb_plugin/lock/lock0lock.c
167---- a/storage/innodb_plugin/lock/lock0lock.c 2011-07-07 19:38:25.711373098 +0900
168-+++ b/storage/innodb_plugin/lock/lock0lock.c 2011-07-07 20:09:02.142335387 +0900
169+--- a/storage/innodb_plugin/lock/lock0lock.c
170++++ b/storage/innodb_plugin/lock/lock0lock.c
171 @@ -3907,6 +3907,10 @@
172
173 trx = thr_get_trx(thr);
174@@ -441,9 +435,8 @@
175 heap_no = page_rec_get_heap_no(rec);
176
177 lock_mutex_enter_kernel();
178-diff -ruN a/storage/innodb_plugin/que/que0que.c b/storage/innodb_plugin/que/que0que.c
179---- a/storage/innodb_plugin/que/que0que.c 2011-07-07 19:38:25.512373167 +0900
180-+++ b/storage/innodb_plugin/que/que0que.c 2011-07-07 20:09:02.144331758 +0900
181+--- a/storage/innodb_plugin/que/que0que.c
182++++ b/storage/innodb_plugin/que/que0que.c
183 @@ -1418,6 +1418,12 @@
184
185 ut_a(trx->error_state == DB_SUCCESS);
186@@ -457,9 +450,8 @@
187 if (reserve_dict_mutex) {
188 mutex_enter(&dict_sys->mutex);
189 }
190-diff -ruN a/storage/innodb_plugin/row/row0ins.c b/storage/innodb_plugin/row/row0ins.c
191---- a/storage/innodb_plugin/row/row0ins.c 2011-07-07 19:38:25.925373011 +0900
192-+++ b/storage/innodb_plugin/row/row0ins.c 2011-07-07 20:09:02.147335402 +0900
193+--- a/storage/innodb_plugin/row/row0ins.c
194++++ b/storage/innodb_plugin/row/row0ins.c
195 @@ -1512,6 +1512,11 @@
196 if (UNIV_LIKELY_NULL(heap)) {
197 mem_heap_free(heap);
198@@ -513,9 +505,8 @@
199 mtr_start(&mtr);
200
201 btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE,
202-diff -ruN a/storage/innodb_plugin/row/row0mysql.c b/storage/innodb_plugin/row/row0mysql.c
203---- a/storage/innodb_plugin/row/row0mysql.c 2011-07-07 19:38:26.139298610 +0900
204-+++ b/storage/innodb_plugin/row/row0mysql.c 2011-07-07 20:09:02.149334904 +0900
205+--- a/storage/innodb_plugin/row/row0mysql.c
206++++ b/storage/innodb_plugin/row/row0mysql.c
207 @@ -1189,6 +1189,7 @@
208 prebuilt->table->stat_n_rows--;
209 }
210@@ -540,9 +531,8 @@
211 row_update_statistics_if_needed(table);
212
213 return(err);
214-diff -ruN a/storage/innodb_plugin/row/row0upd.c b/storage/innodb_plugin/row/row0upd.c
215---- a/storage/innodb_plugin/row/row0upd.c 2011-07-07 19:38:25.530295605 +0900
216-+++ b/storage/innodb_plugin/row/row0upd.c 2011-07-07 20:09:02.152334950 +0900
217+--- a/storage/innodb_plugin/row/row0upd.c
218++++ b/storage/innodb_plugin/row/row0upd.c
219 @@ -1591,8 +1591,9 @@
220
221 mtr_start(&mtr);
222@@ -606,9 +596,8 @@
223
224 if (!success) {
225 err = DB_RECORD_NOT_FOUND;
226-diff -ruN a/storage/innodb_plugin/trx/trx0trx.c b/storage/innodb_plugin/trx/trx0trx.c
227---- a/storage/innodb_plugin/trx/trx0trx.c 2011-07-07 19:47:22.358333765 +0900
228-+++ b/storage/innodb_plugin/trx/trx0trx.c 2011-07-07 20:09:02.156330704 +0900
229+--- a/storage/innodb_plugin/trx/trx0trx.c
230++++ b/storage/innodb_plugin/trx/trx0trx.c
231 @@ -114,6 +114,8 @@
232
233 trx->flush_log_at_trx_commit_session = 3; /* means to use innodb_flush_log_at_trx_commit value */
234@@ -618,3 +607,162 @@
235 trx->check_foreigns = TRUE;
236 trx->check_unique_secondary = TRUE;
237
238+--- /dev/null
239++++ b/mysql-test/r/percona_innodb_fake_changes.result
240+@@ -0,0 +1,55 @@
241++DROP TABLE IF EXISTS t1;
242++# Checking variables
243++SHOW VARIABLES LIKE 'innodb_fake_changes';
244++Variable_name Value
245++innodb_fake_changes OFF
246++SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='innodb_fake_changes';
247++VARIABLE_VALUE
248++OFF
249++SET innodb_fake_changes=1;
250++SHOW VARIABLES LIKE 'innodb_fake_changes';
251++Variable_name Value
252++innodb_fake_changes ON
253++SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='innodb_fake_changes';
254++VARIABLE_VALUE
255++ON
256++SET innodb_fake_changes=default;
257++SHOW VARIABLES LIKE 'innodb_fake_changes';
258++Variable_name Value
259++innodb_fake_changes OFF
260++SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='innodb_fake_changes';
261++VARIABLE_VALUE
262++OFF
263++# Explicit COMMIT should fail when innodb_fake_changes is enabled
264++# DML should be fine
265++CREATE TABLE t1 (a INT) ENGINE=InnoDB;
266++INSERT INTO t1 VALUES (1);
267++SET autocommit=0;
268++SET innodb_fake_changes=1;
269++BEGIN;
270++INSERT INTO t1 VALUES (2);
271++UPDATE t1 SET a=0;
272++DELETE FROM t1 LIMIT 1;
273++SELECT * FROM t1;
274++a
275++1
276++COMMIT;
277++ERROR HY000: Got error 131 during COMMIT
278++SET innodb_fake_changes=default;
279++DROP TABLE t1;
280++# DDL must result in error
281++CREATE TABLE t1 (a INT) ENGINE=InnoDB;
282++SET autocommit=0;
283++SET innodb_fake_changes=1;
284++BEGIN;
285++CREATE TABLE t2 (a INT) ENGINE=InnoDB;
286++ERROR HY000: Can't create table 'test.t2' (errno: 131)
287++DROP TABLE t1;
288++ERROR 42S02: Unknown table 't1'
289++TRUNCATE TABLE t1;
290++ERROR HY000: Got error 131 during COMMIT
291++ALTER TABLE t1 ENGINE=MyISAM;
292++ERROR HY000: Got error 131 during COMMIT
293++ROLLBACK;
294++SET innodb_fake_changes=default;
295++DROP TABLE t1;
296+--- /dev/null
297++++ b/mysql-test/r/percona_innodb_fake_changes_locks.result
298+@@ -0,0 +1,19 @@
299++DROP TABLE IF EXISTS t1;
300++# Verifying that X_LOCK not acquired
301++CREATE TABLE t1 (a INT) ENGINE=InnoDB;
302++INSERT INTO t1 VALUES (1);
303++SET autocommit=0;
304++SET innodb_fake_changes=1;
305++BEGIN;
306++SELECT * FROM t1 FOR UPDATE;
307++a
308++1
309++SET innodb_lock_wait_timeout=3;
310++UPDATE t1 SET a=2;
311++ERROR HY000: Lock wait timeout exceeded; try restarting transaction
312++SELECT * FROM t1 LOCK IN SHARE MODE;
313++a
314++1
315++ROLLBACK;
316++SET innodb_fake_changes=default;
317++DROP TABLE t1;
318+--- /dev/null
319++++ b/mysql-test/t/percona_innodb_fake_changes.test
320+@@ -0,0 +1,49 @@
321++--source include/have_innodb_plugin.inc
322++
323++--disable_warnings
324++DROP TABLE IF EXISTS t1;
325++--enable_warnings
326++
327++
328++--echo # Checking variables
329++SHOW VARIABLES LIKE 'innodb_fake_changes';
330++SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='innodb_fake_changes';
331++SET innodb_fake_changes=1;
332++SHOW VARIABLES LIKE 'innodb_fake_changes';
333++SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='innodb_fake_changes';
334++SET innodb_fake_changes=default;
335++SHOW VARIABLES LIKE 'innodb_fake_changes';
336++SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='innodb_fake_changes';
337++
338++--echo # Explicit COMMIT should fail when innodb_fake_changes is enabled
339++--echo # DML should be fine
340++CREATE TABLE t1 (a INT) ENGINE=InnoDB;
341++INSERT INTO t1 VALUES (1);
342++SET autocommit=0;
343++SET innodb_fake_changes=1;
344++BEGIN;
345++INSERT INTO t1 VALUES (2);
346++UPDATE t1 SET a=0;
347++DELETE FROM t1 LIMIT 1;
348++SELECT * FROM t1;
349++--error 1180
350++COMMIT;
351++SET innodb_fake_changes=default;
352++DROP TABLE t1;
353++
354++--echo # DDL must result in error
355++CREATE TABLE t1 (a INT) ENGINE=InnoDB;
356++SET autocommit=0;
357++SET innodb_fake_changes=1;
358++BEGIN;
359++--error 1005
360++CREATE TABLE t2 (a INT) ENGINE=InnoDB;
361++--error 1051
362++DROP TABLE t1;
363++--error 1180
364++TRUNCATE TABLE t1;
365++--error 1180
366++ALTER TABLE t1 ENGINE=MyISAM;
367++ROLLBACK;
368++SET innodb_fake_changes=default;
369++DROP TABLE t1;
370+--- /dev/null
371++++ b/mysql-test/t/percona_innodb_fake_changes_locks.test
372+@@ -0,0 +1,24 @@
373++--source include/have_innodb_plugin.inc
374++
375++--disable_warnings
376++DROP TABLE IF EXISTS t1;
377++--enable_warnings
378++
379++--echo # Verifying that X_LOCK not acquired
380++CREATE TABLE t1 (a INT) ENGINE=InnoDB;
381++INSERT INTO t1 VALUES (1);
382++--connect (conn1,localhost,root,,)
383++--connection conn1
384++SET autocommit=0;
385++SET innodb_fake_changes=1;
386++BEGIN;
387++SELECT * FROM t1 FOR UPDATE;
388++--connection default
389++SET innodb_lock_wait_timeout=3;
390++--error 1205
391++UPDATE t1 SET a=2;
392++SELECT * FROM t1 LOCK IN SHARE MODE;
393++--connection conn1
394++ROLLBACK;
395++SET innodb_fake_changes=default;
396++DROP TABLE t1;
397
398=== modified file 'patches/innodb_fast_shutdown.patch'
399--- patches/innodb_fast_shutdown.patch 2011-07-30 22:04:31 +0000
400+++ patches/innodb_fast_shutdown.patch 2011-10-04 21:42:26 +0000
401@@ -159,7 +159,7 @@
402
403 --- a/storage/innodb_plugin/srv/srv0srv.c
404 +++ b/storage/innodb_plugin/srv/srv0srv.c
405-@@ -708,6 +708,8 @@
406+@@ -716,6 +716,8 @@
407
408 UNIV_INTERN os_event_t srv_lock_timeout_thread_event;
409
410@@ -168,7 +168,7 @@
411 UNIV_INTERN srv_sys_t* srv_sys = NULL;
412
413 /* padding to prevent other memory update hotspots from residing on
414-@@ -1013,6 +1015,7 @@
415+@@ -1021,6 +1023,7 @@
416 }
417
418 srv_lock_timeout_thread_event = os_event_create(NULL);
419@@ -176,7 +176,7 @@
420
421 for (i = 0; i < SRV_MASTER + 1; i++) {
422 srv_n_threads_active[i] = 0;
423-@@ -2240,7 +2243,7 @@
424+@@ -2248,7 +2251,7 @@
425 /* Wake up every 5 seconds to see if we need to print
426 monitor information. */
427
428@@ -185,7 +185,7 @@
429
430 current_time = time(NULL);
431
432-@@ -2382,7 +2385,7 @@
433+@@ -2390,7 +2393,7 @@
434 /* When someone is waiting for a lock, we wake up every second
435 and check if a timeout has passed for a lock wait */
436
437@@ -194,7 +194,7 @@
438
439 srv_lock_timeout_active = TRUE;
440
441-@@ -2556,7 +2559,7 @@
442+@@ -2594,7 +2597,7 @@
443
444 fflush(stderr);
445
446@@ -203,7 +203,7 @@
447
448 if (srv_shutdown_state < SRV_SHUTDOWN_CLEANUP) {
449
450-@@ -2600,7 +2603,7 @@
451+@@ -2638,7 +2641,7 @@
452 last_dump_time = time(NULL);
453
454 loop:
455@@ -212,7 +212,7 @@
456
457 if (srv_shutdown_state >= SRV_SHUTDOWN_CLEANUP) {
458 goto exit_func;
459-@@ -2783,7 +2786,7 @@
460+@@ -2821,7 +2824,7 @@
461 if (!skip_sleep) {
462 if (next_itr_time > cur_time) {
463
464@@ -221,7 +221,7 @@
465 srv_main_sleeps++;
466
467 /*
468-@@ -3490,9 +3493,10 @@
469+@@ -3528,9 +3531,10 @@
470 mutex_exit(&kernel_mutex);
471
472 sleep_ms = 10;
473
474=== renamed file 'innodb_kill_idle_transaction.patch' => 'patches/innodb_kill_idle_transaction.patch'
475--- innodb_kill_idle_transaction.patch 2011-07-07 13:02:19 +0000
476+++ patches/innodb_kill_idle_transaction.patch 2011-10-04 21:42:26 +0000
477@@ -5,9 +5,8 @@
478 #!!! notice !!!
479 # Any small change to this file in the main branch
480 # should be done or reviewed by the maintainer!
481-diff -ruN a/include/mysql/plugin.h b/include/mysql/plugin.h
482---- a/include/mysql/plugin.h 2011-07-07 19:38:24.650374103 +0900
483-+++ b/include/mysql/plugin.h 2011-07-07 19:39:44.611713196 +0900
484+--- a/include/mysql/plugin.h
485++++ b/include/mysql/plugin.h
486 @@ -845,6 +845,12 @@
487 */
488 void thd_set_ha_data(MYSQL_THD thd, const struct handlerton *hton,
489@@ -21,9 +20,8 @@
490 #ifdef __cplusplus
491 }
492 #endif
493-diff -ruN a/include/mysql/plugin.h.pp b/include/mysql/plugin.h.pp
494---- a/include/mysql/plugin.h.pp 2011-07-07 19:38:24.423414787 +0900
495-+++ b/include/mysql/plugin.h.pp 2011-07-07 19:39:44.615372555 +0900
496+--- a/include/mysql/plugin.h.pp
497++++ b/include/mysql/plugin.h.pp
498 @@ -150,3 +150,6 @@
499 void *thd_get_ha_data(const void* thd, const struct handlerton *hton);
500 void thd_set_ha_data(void* thd, const struct handlerton *hton,
501@@ -31,9 +29,8 @@
502 +int thd_command(const void* thd);
503 +long long thd_start_time(const void* thd);
504 +void thd_kill(void* thd);
505-diff -ruN a/sql/sql_class.cc b/sql/sql_class.cc
506---- a/sql/sql_class.cc 2011-07-07 19:38:24.999372326 +0900
507-+++ b/sql/sql_class.cc 2011-07-07 19:39:44.619370533 +0900
508+--- a/sql/sql_class.cc
509++++ b/sql/sql_class.cc
510 @@ -468,6 +468,26 @@
511 return buffer;
512 }
513@@ -61,9 +58,8 @@
514
515 /**
516 Implementation of Drop_table_error_handler::handle_error().
517-diff -ruN a/storage/innodb_plugin/handler/ha_innodb.cc b/storage/innodb_plugin/handler/ha_innodb.cc
518---- a/storage/innodb_plugin/handler/ha_innodb.cc 2011-07-07 19:38:26.162373407 +0900
519-+++ b/storage/innodb_plugin/handler/ha_innodb.cc 2011-07-07 19:39:44.625370650 +0900
520+--- a/storage/innodb_plugin/handler/ha_innodb.cc
521++++ b/storage/innodb_plugin/handler/ha_innodb.cc
522 @@ -2511,6 +2511,10 @@
523
524 innobase_commit_concurrency_init_default();
525@@ -148,9 +144,8 @@
526 MYSQL_SYSVAR(data_file_path),
527 MYSQL_SYSVAR(doublewrite_file),
528 MYSQL_SYSVAR(data_home_dir),
529-diff -ruN a/storage/innodb_plugin/include/srv0srv.h b/storage/innodb_plugin/include/srv0srv.h
530---- a/storage/innodb_plugin/include/srv0srv.h 2011-07-07 19:38:26.128372970 +0900
531-+++ b/storage/innodb_plugin/include/srv0srv.h 2011-07-07 19:39:44.646824971 +0900
532+--- a/storage/innodb_plugin/include/srv0srv.h
533++++ b/storage/innodb_plugin/include/srv0srv.h
534 @@ -281,6 +281,7 @@
535 extern ulint srv_activity_count;
536 extern ulint srv_fatal_semaphore_wait_threshold;
537@@ -159,9 +154,8 @@
538
539 extern mutex_t* kernel_mutex_temp;/* mutex protecting the server, trx structs,
540 query threads, and lock table: we allocate
541-diff -ruN a/storage/innodb_plugin/include/trx0trx.h b/storage/innodb_plugin/include/trx0trx.h
542---- a/storage/innodb_plugin/include/trx0trx.h 2011-07-07 19:38:25.705377859 +0900
543-+++ b/storage/innodb_plugin/include/trx0trx.h 2011-07-07 19:39:44.650304314 +0900
544+--- a/storage/innodb_plugin/include/trx0trx.h
545++++ b/storage/innodb_plugin/include/trx0trx.h
546 @@ -600,6 +600,8 @@
547 ulint mysql_process_no;/* since in Linux, 'top' reports
548 process id's and not thread id's, we
549@@ -171,9 +165,8 @@
550 /*------------------------------*/
551 ulint n_mysql_tables_in_use; /* number of Innobase tables
552 used in the processing of the current
553-diff -ruN a/storage/innodb_plugin/srv/srv0srv.c b/storage/innodb_plugin/srv/srv0srv.c
554---- a/storage/innodb_plugin/srv/srv0srv.c 2011-07-07 19:38:26.147372081 +0900
555-+++ b/storage/innodb_plugin/srv/srv0srv.c 2011-07-07 19:39:44.658303810 +0900
556+--- a/storage/innodb_plugin/srv/srv0srv.c
557++++ b/storage/innodb_plugin/srv/srv0srv.c
558 @@ -86,6 +86,11 @@
559 #include "trx0i_s.h"
560 #include "os0sync.h" /* for HAVE_ATOMIC_BUILTINS */
561@@ -233,9 +226,8 @@
562 /* Flush stderr so that a database user gets the output
563 to possible MySQL error file */
564
565-diff -ruN a/storage/innodb_plugin/trx/trx0trx.c b/storage/innodb_plugin/trx/trx0trx.c
566---- a/storage/innodb_plugin/trx/trx0trx.c 2011-07-07 19:38:25.723372433 +0900
567-+++ b/storage/innodb_plugin/trx/trx0trx.c 2011-07-07 19:39:44.665304098 +0900
568+--- a/storage/innodb_plugin/trx/trx0trx.c
569++++ b/storage/innodb_plugin/trx/trx0trx.c
570 @@ -137,6 +137,9 @@
571 trx->mysql_relay_log_file_name = "";
572 trx->mysql_relay_log_pos = 0;
573@@ -246,3 +238,160 @@
574 mutex_create(&trx->undo_mutex, SYNC_TRX_UNDO);
575
576 trx->rseg = NULL;
577+--- /dev/null
578++++ b/mysql-test/r/percona_innodb_kill_idle_trx.result
579+@@ -0,0 +1,41 @@
580++DROP TABLE IF EXISTS t1;
581++SET autocommit=0;
582++CREATE TABLE t1 (a INT) ENGINE=InnoDB;
583++SHOW GLOBAL VARIABLES LIKE 'innodb_kill_idle_transaction';
584++Variable_name Value
585++innodb_kill_idle_transaction 0
586++SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_kill_idle_transaction';
587++VARIABLE_NAME VARIABLE_VALUE
588++INNODB_KILL_IDLE_TRANSACTION 0
589++SET GLOBAL innodb_kill_idle_transaction=1;
590++SHOW GLOBAL VARIABLES LIKE 'innodb_kill_idle_transaction';
591++Variable_name Value
592++innodb_kill_idle_transaction 1
593++SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_kill_idle_transaction';
594++VARIABLE_NAME VARIABLE_VALUE
595++INNODB_KILL_IDLE_TRANSACTION 1
596++BEGIN;
597++INSERT INTO t1 VALUES (1),(2),(3);
598++COMMIT;
599++SELECT * FROM t1;
600++a
601++1
602++2
603++3
604++BEGIN;
605++INSERT INTO t1 VALUES (4),(5),(6);
606++SELECT * FROM t1;
607++ERROR HY000: MySQL server has gone away
608++SELECT * FROM t1;
609++a
610++1
611++2
612++3
613++DROP TABLE t1;
614++SET GLOBAL innodb_kill_idle_transaction=0;
615++SHOW GLOBAL VARIABLES LIKE 'innodb_kill_idle_transaction';
616++Variable_name Value
617++innodb_kill_idle_transaction 0
618++SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_kill_idle_transaction';
619++VARIABLE_NAME VARIABLE_VALUE
620++INNODB_KILL_IDLE_TRANSACTION 0
621+--- /dev/null
622++++ b/mysql-test/r/percona_innodb_kill_idle_trx_locks.result
623+@@ -0,0 +1,45 @@
624++DROP TABLE IF EXISTS t1;
625++SET autocommit=0;
626++CREATE TABLE t1 (a INT) ENGINE=InnoDB;
627++SHOW GLOBAL VARIABLES LIKE 'innodb_kill_idle_transaction';
628++Variable_name Value
629++innodb_kill_idle_transaction 0
630++SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_kill_idle_transaction';
631++VARIABLE_NAME VARIABLE_VALUE
632++INNODB_KILL_IDLE_TRANSACTION 0
633++SET GLOBAL innodb_kill_idle_transaction=5;
634++SHOW GLOBAL VARIABLES LIKE 'innodb_kill_idle_transaction';
635++Variable_name Value
636++innodb_kill_idle_transaction 5
637++SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_kill_idle_transaction';
638++VARIABLE_NAME VARIABLE_VALUE
639++INNODB_KILL_IDLE_TRANSACTION 5
640++BEGIN;
641++INSERT INTO t1 VALUES (1),(2),(3);
642++COMMIT;
643++SELECT * FROM t1;
644++a
645++1
646++2
647++3
648++### Locking rows. Lock should be released when idle trx is killed.
649++BEGIN;
650++SELECT * FROM t1 FOR UPDATE;
651++a
652++1
653++2
654++3
655++UPDATE t1 set a=4;
656++SELECT * FROM t1;
657++a
658++4
659++4
660++4
661++DROP TABLE t1;
662++SET GLOBAL innodb_kill_idle_transaction=0;
663++SHOW GLOBAL VARIABLES LIKE 'innodb_kill_idle_transaction';
664++Variable_name Value
665++innodb_kill_idle_transaction 0
666++SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_kill_idle_transaction';
667++VARIABLE_NAME VARIABLE_VALUE
668++INNODB_KILL_IDLE_TRANSACTION 0
669+--- /dev/null
670++++ b/mysql-test/t/percona_innodb_kill_idle_trx.test
671+@@ -0,0 +1,28 @@
672++--source include/have_innodb.inc
673++--disable_warnings
674++DROP TABLE IF EXISTS t1;
675++--enable_warnings
676++
677++SET autocommit=0;
678++CREATE TABLE t1 (a INT) ENGINE=InnoDB;
679++
680++--source include/percona_innodb_kill_idle_trx_show.inc
681++SET GLOBAL innodb_kill_idle_transaction=1;
682++--source include/percona_innodb_kill_idle_trx_show.inc
683++
684++BEGIN;
685++INSERT INTO t1 VALUES (1),(2),(3);
686++COMMIT;
687++SELECT * FROM t1;
688++
689++BEGIN;
690++INSERT INTO t1 VALUES (4),(5),(6);
691++sleep 3;
692++
693++--enable_reconnect
694++--error 2006 --error CR_SERVER_GONE_ERROR
695++SELECT * FROM t1;
696++SELECT * FROM t1;
697++DROP TABLE t1;
698++SET GLOBAL innodb_kill_idle_transaction=0;
699++--source include/percona_innodb_kill_idle_trx_show.inc
700+--- /dev/null
701++++ b/mysql-test/t/percona_innodb_kill_idle_trx_locks.test
702+@@ -0,0 +1,31 @@
703++--source include/have_innodb.inc
704++--disable_warnings
705++DROP TABLE IF EXISTS t1;
706++--enable_warnings
707++
708++SET autocommit=0;
709++CREATE TABLE t1 (a INT) ENGINE=InnoDB;
710++
711++--source include/percona_innodb_kill_idle_trx_show.inc
712++SET GLOBAL innodb_kill_idle_transaction=5;
713++--source include/percona_innodb_kill_idle_trx_show.inc
714++
715++connect (conn1,localhost,root,,);
716++connection conn1;
717++
718++BEGIN;
719++INSERT INTO t1 VALUES (1),(2),(3);
720++COMMIT;
721++SELECT * FROM t1;
722++
723++--echo ### Locking rows. Lock should be released when idle trx is killed.
724++BEGIN;
725++SELECT * FROM t1 FOR UPDATE;
726++
727++connection default;
728++UPDATE t1 set a=4;
729++
730++SELECT * FROM t1;
731++DROP TABLE t1;
732++SET GLOBAL innodb_kill_idle_transaction=0;
733++--source include/percona_innodb_kill_idle_trx_show.inc
734
735=== modified file 'patches/innodb_split_buf_pool_mutex.patch'
736--- patches/innodb_split_buf_pool_mutex.patch 2011-08-09 13:35:34 +0000
737+++ patches/innodb_split_buf_pool_mutex.patch 2011-10-04 21:42:26 +0000
738@@ -1048,7 +1048,7 @@
739 ulint fix_type;
740 ibool must_read;
741 ulint retries = 0;
742-+ mutex_t* block_mutex;
743++ mutex_t* block_mutex = NULL;
744
745 ut_ad(mtr);
746 ut_ad(mtr->state == MTR_ACTIVE);
747
748=== modified file 'patches/series'
749--- patches/series 2011-09-24 20:18:57 +0000
750+++ patches/series 2011-10-04 21:42:26 +0000
751@@ -34,6 +34,8 @@
752 innodb_show_sys_tables.patch
753 innodb_fix_misc.patch
754 innodb_adjust_defaults.patch
755+innodb_kill_idle_transaction.patch
756+innodb_fake_changes.patch
757 mysql-test.diff
758 percona-support.patch
759 innodb_deadlock_count.patch

Subscribers

People subscribed via source and target branches