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

Proposed by Valentine Gostev
Status: Superseded
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) Needs Fixing
Review via email: mp+77238@code.launchpad.net

This proposal has been superseded by a proposal from 2011-10-04.

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

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)

Revision history for this message
Stewart Smith (stewart) wrote :
review: Needs Fixing
Revision history for this message
Yasufumi Kinoshita (yasufumi-kinoshita) wrote :

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.

Revision history for this message
Valentine Gostev (longbow) wrote :
282. By kinoyasu <kinoyasu@gauntlet4>

fix bug863294 and misc build warning

283. By kinoyasu <kinoyasu@gauntlet4>

fix bug871722

Unmerged revisions

283. By kinoyasu <kinoyasu@gauntlet4>

fix bug871722

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'patches/innodb_buffer_pool_shm.patch'
--- patches/innodb_buffer_pool_shm.patch 2011-09-06 08:23:51 +0000
+++ patches/innodb_buffer_pool_shm.patch 2011-10-04 05:52:29 +0000
@@ -42,7 +42,7 @@
42 42
43 static char* internal_innobase_data_file_path = NULL;43 static char* internal_innobase_data_file_path = NULL;
44 44
45@@ -2460,6 +2462,12 @@45@@ -2468,6 +2470,12 @@
46 46
47 srv_buf_pool_size = (ulint) innobase_buffer_pool_size;47 srv_buf_pool_size = (ulint) innobase_buffer_pool_size;
48 48
@@ -55,7 +55,7 @@
55 srv_mem_pool_size = (ulint) innobase_additional_mem_pool_size;55 srv_mem_pool_size = (ulint) innobase_additional_mem_pool_size;
56 56
57 srv_n_file_io_threads = (ulint) innobase_file_io_threads;57 srv_n_file_io_threads = (ulint) innobase_file_io_threads;
58@@ -11472,6 +11480,16 @@58@@ -11562,6 +11570,16 @@
59 "The size of the memory buffer InnoDB uses to cache data and indexes of its tables.",59 "The size of the memory buffer InnoDB uses to cache data and indexes of its tables.",
60 NULL, NULL, 128*1024*1024L, 32*1024*1024L, LONGLONG_MAX, 1024*1024L);60 NULL, NULL, 128*1024*1024L, 32*1024*1024L, LONGLONG_MAX, 1024*1024L);
61 61
@@ -72,7 +72,7 @@
72 static MYSQL_SYSVAR_ULONG(commit_concurrency, innobase_commit_concurrency,72 static MYSQL_SYSVAR_ULONG(commit_concurrency, innobase_commit_concurrency,
73 PLUGIN_VAR_RQCMDARG,73 PLUGIN_VAR_RQCMDARG,
74 "Helps in performance tuning in heavily concurrent environments.",74 "Helps in performance tuning in heavily concurrent environments.",
75@@ -11760,6 +11778,8 @@75@@ -11859,6 +11877,8 @@
76 MYSQL_SYSVAR(additional_mem_pool_size),76 MYSQL_SYSVAR(additional_mem_pool_size),
77 MYSQL_SYSVAR(autoextend_increment),77 MYSQL_SYSVAR(autoextend_increment),
78 MYSQL_SYSVAR(buffer_pool_size),78 MYSQL_SYSVAR(buffer_pool_size),
7979
=== modified file 'patches/innodb_deadlock_count.patch'
--- patches/innodb_deadlock_count.patch 2011-09-06 08:23:51 +0000
+++ patches/innodb_deadlock_count.patch 2011-10-04 05:52:29 +0000
@@ -7,7 +7,7 @@
7# should be done or reviewed by the maintainer!7# should be done or reviewed by the maintainer!
8--- a/storage/innodb_plugin/handler/ha_innodb.cc8--- a/storage/innodb_plugin/handler/ha_innodb.cc
9+++ b/storage/innodb_plugin/handler/ha_innodb.cc9+++ b/storage/innodb_plugin/handler/ha_innodb.cc
10@@ -566,6 +566,8 @@10@@ -572,6 +572,8 @@
11 (char*) &export_vars.innodb_data_written, SHOW_LONG},11 (char*) &export_vars.innodb_data_written, SHOW_LONG},
12 {"dblwr_pages_written",12 {"dblwr_pages_written",
13 (char*) &export_vars.innodb_dblwr_pages_written, SHOW_LONG},13 (char*) &export_vars.innodb_dblwr_pages_written, SHOW_LONG},
@@ -28,7 +28,7 @@
28 Gets the size of a lock struct.28 Gets the size of a lock struct.
29--- a/storage/innodb_plugin/include/srv0srv.h29--- a/storage/innodb_plugin/include/srv0srv.h
30+++ b/storage/innodb_plugin/include/srv0srv.h30+++ b/storage/innodb_plugin/include/srv0srv.h
31@@ -689,6 +689,7 @@31@@ -690,6 +690,7 @@
32 ulint innodb_buffer_pool_write_requests;/*!< srv_buf_pool_write_requests */32 ulint innodb_buffer_pool_write_requests;/*!< srv_buf_pool_write_requests */
33 ulint innodb_buffer_pool_read_ahead; /*!< srv_read_ahead */33 ulint innodb_buffer_pool_read_ahead; /*!< srv_read_ahead */
34 ulint innodb_buffer_pool_read_ahead_evicted;/*!< srv_read_ahead evicted*/34 ulint innodb_buffer_pool_read_ahead_evicted;/*!< srv_read_ahead evicted*/
@@ -48,7 +48,7 @@
48 break;48 break;
49--- a/storage/innodb_plugin/srv/srv0srv.c49--- a/storage/innodb_plugin/srv/srv0srv.c
50+++ b/storage/innodb_plugin/srv/srv0srv.c50+++ b/storage/innodb_plugin/srv/srv0srv.c
51@@ -444,7 +444,7 @@51@@ -452,7 +452,7 @@
52 static ulint srv_n_rows_updated_old = 0;52 static ulint srv_n_rows_updated_old = 0;
53 static ulint srv_n_rows_deleted_old = 0;53 static ulint srv_n_rows_deleted_old = 0;
54 static ulint srv_n_rows_read_old = 0;54 static ulint srv_n_rows_read_old = 0;
@@ -57,7 +57,7 @@
57 UNIV_INTERN ulint srv_n_lock_wait_count = 0;57 UNIV_INTERN ulint srv_n_lock_wait_count = 0;
58 UNIV_INTERN ulint srv_n_lock_wait_current_count = 0;58 UNIV_INTERN ulint srv_n_lock_wait_current_count = 0;
59 UNIV_INTERN ib_int64_t srv_n_lock_wait_time = 0;59 UNIV_INTERN ib_int64_t srv_n_lock_wait_time = 0;
60@@ -2155,6 +2155,8 @@60@@ -2163,6 +2163,8 @@
61 = UT_LIST_GET_LEN(buf_pool->flush_list);61 = UT_LIST_GET_LEN(buf_pool->flush_list);
62 export_vars.innodb_buffer_pool_pages_free62 export_vars.innodb_buffer_pool_pages_free
63 = UT_LIST_GET_LEN(buf_pool->free);63 = UT_LIST_GET_LEN(buf_pool->free);
6464
=== modified file 'patches/innodb_extend_slow.patch'
--- patches/innodb_extend_slow.patch 2011-09-24 20:18:57 +0000
+++ patches/innodb_extend_slow.patch 2011-10-04 05:52:29 +0000
@@ -106,7 +106,7 @@
106@@ -2119,6 +2174,11 @@106@@ -2119,6 +2174,11 @@
107 ibool must_read;107 ibool must_read;
108 ulint retries = 0;108 ulint retries = 0;
109 mutex_t* block_mutex;109 mutex_t* block_mutex = NULL;
110+ trx_t* trx = NULL;110+ trx_t* trx = NULL;
111+ ulint sec;111+ ulint sec;
112+ ulint ms;112+ ulint ms;
113113
=== renamed file 'innodb_fake_changes.patch' => 'patches/innodb_fake_changes.patch'
--- innodb_fake_changes.patch 2011-07-07 13:02:19 +0000
+++ patches/innodb_fake_changes.patch 2011-10-04 05:52:29 +0000
@@ -5,9 +5,8 @@
5#!!! notice !!!5#!!! notice !!!
6# Any small change to this file in the main branch6# Any small change to this file in the main branch
7# should be done or reviewed by the maintainer!7# should be done or reviewed by the maintainer!
8diff -ruN a/storage/innodb_plugin/btr/btr0cur.c b/storage/innodb_plugin/btr/btr0cur.c8--- a/storage/innodb_plugin/btr/btr0cur.c
9--- a/storage/innodb_plugin/btr/btr0cur.c 2011-07-07 19:38:25.840371992 +09009+++ b/storage/innodb_plugin/btr/btr0cur.c
10+++ b/storage/innodb_plugin/btr/btr0cur.c 2011-07-07 20:09:02.125335731 +0900
11@@ -1046,6 +1046,11 @@10@@ -1046,6 +1046,11 @@
12 rec_t* rec;11 rec_t* rec;
13 roll_ptr_t roll_ptr;12 roll_ptr_t roll_ptr;
@@ -179,9 +178,8 @@
179 block = btr_cur_get_block(cursor);178 block = btr_cur_get_block(cursor);
180 rec = btr_cur_get_rec(cursor);179 rec = btr_cur_get_rec(cursor);
181 180
182diff -ruN a/storage/innodb_plugin/handler/ha_innodb.cc b/storage/innodb_plugin/handler/ha_innodb.cc181--- a/storage/innodb_plugin/handler/ha_innodb.cc
183--- a/storage/innodb_plugin/handler/ha_innodb.cc 2011-07-07 19:47:22.334541114 +0900182+++ b/storage/innodb_plugin/handler/ha_innodb.cc
184+++ b/storage/innodb_plugin/handler/ha_innodb.cc 2011-07-07 20:17:01.737288508 +0900
185@@ -367,6 +367,12 @@183@@ -367,6 +367,12 @@
186 "The value 3 regards innodb_flush_log_at_trx_commit (default).",184 "The value 3 regards innodb_flush_log_at_trx_commit (default).",
187 NULL, NULL, 3, 0, 3, 0);185 NULL, NULL, 3, 0, 3, 0);
@@ -208,11 +206,11 @@
208 trx_search_latch_release_if_reserved(trx);206 trx_search_latch_release_if_reserved(trx);
209 }207 }
210 208
211+ if (trx->fake_changes) {209+ if (trx->fake_changes && (all || (!thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))) {
212+ innobase_rollback(hton, thd, all); /* rollback implicitly */210+ innobase_rollback(hton, thd, all); /* rollback implicitly */
211+ thd->main_da.reset_diagnostics_area(); /* because debug assertion code complains, if something left */
213+ DBUG_RETURN(HA_ERR_WRONG_COMMAND);212+ DBUG_RETURN(HA_ERR_WRONG_COMMAND);
214+ }213+ }
215+
216 /* The flag trx->active_trans is set to 1 in214 /* The flag trx->active_trans is set to 1 in
217 215
218 1. ::external_lock(),216 1. ::external_lock(),
@@ -297,9 +295,8 @@
297 NULL295 NULL
298 };296 };
299 297
300diff -ruN a/storage/innodb_plugin/handler/handler0alter.cc b/storage/innodb_plugin/handler/handler0alter.cc298--- a/storage/innodb_plugin/handler/handler0alter.cc
301--- a/storage/innodb_plugin/handler/handler0alter.cc 2011-07-02 00:22:17.000000000 +0900299+++ b/storage/innodb_plugin/handler/handler0alter.cc
302+++ b/storage/innodb_plugin/handler/handler0alter.cc 2011-07-07 20:36:26.885315930 +0900
303@@ -652,6 +652,9 @@300@@ -652,6 +652,9 @@
304 /* In case MySQL calls this in the middle of a SELECT query, release301 /* In case MySQL calls this in the middle of a SELECT query, release
305 possible adaptive hash latch to avoid deadlocks of threads. */302 possible adaptive hash latch to avoid deadlocks of threads. */
@@ -348,9 +345,8 @@
348 trx_start_if_not_started(trx);345 trx_start_if_not_started(trx);
349 346
350 /* Flag this transaction as a dictionary operation, so that347 /* Flag this transaction as a dictionary operation, so that
351diff -ruN a/storage/innodb_plugin/ibuf/ibuf0ibuf.c b/storage/innodb_plugin/ibuf/ibuf0ibuf.c348--- a/storage/innodb_plugin/ibuf/ibuf0ibuf.c
352--- a/storage/innodb_plugin/ibuf/ibuf0ibuf.c 2011-07-07 19:38:25.352373413 +0900349+++ b/storage/innodb_plugin/ibuf/ibuf0ibuf.c
353+++ b/storage/innodb_plugin/ibuf/ibuf0ibuf.c 2011-07-07 20:09:02.137334934 +0900
354@@ -2613,6 +2613,8 @@350@@ -2613,6 +2613,8 @@
355 351
356 ut_a(trx_sys_multiple_tablespace_format);352 ut_a(trx_sys_multiple_tablespace_format);
@@ -360,9 +356,8 @@
360 do_merge = FALSE;356 do_merge = FALSE;
361 357
362 mutex_enter(&ibuf_mutex);358 mutex_enter(&ibuf_mutex);
363diff -ruN a/storage/innodb_plugin/include/trx0trx.h b/storage/innodb_plugin/include/trx0trx.h359--- a/storage/innodb_plugin/include/trx0trx.h
364--- a/storage/innodb_plugin/include/trx0trx.h 2011-07-07 19:47:22.348325198 +0900360+++ b/storage/innodb_plugin/include/trx0trx.h
365+++ b/storage/innodb_plugin/include/trx0trx.h 2011-07-07 20:09:02.139302150 +0900
366@@ -509,6 +509,7 @@361@@ -509,6 +509,7 @@
367 150 bytes in the undo log size as then362 150 bytes in the undo log size as then
368 we skip XA steps */363 we skip XA steps */
@@ -371,9 +366,8 @@
371 ulint flush_log_later;/* In 2PC, we hold the366 ulint flush_log_later;/* In 2PC, we hold the
372 prepare_commit mutex across367 prepare_commit mutex across
373 both phases. In that case, we368 both phases. In that case, we
374diff -ruN a/storage/innodb_plugin/lock/lock0lock.c b/storage/innodb_plugin/lock/lock0lock.c369--- a/storage/innodb_plugin/lock/lock0lock.c
375--- a/storage/innodb_plugin/lock/lock0lock.c 2011-07-07 19:38:25.711373098 +0900370+++ b/storage/innodb_plugin/lock/lock0lock.c
376+++ b/storage/innodb_plugin/lock/lock0lock.c 2011-07-07 20:09:02.142335387 +0900
377@@ -3907,6 +3907,10 @@371@@ -3907,6 +3907,10 @@
378 372
379 trx = thr_get_trx(thr);373 trx = thr_get_trx(thr);
@@ -441,9 +435,8 @@
441 heap_no = page_rec_get_heap_no(rec);435 heap_no = page_rec_get_heap_no(rec);
442 436
443 lock_mutex_enter_kernel();437 lock_mutex_enter_kernel();
444diff -ruN a/storage/innodb_plugin/que/que0que.c b/storage/innodb_plugin/que/que0que.c438--- a/storage/innodb_plugin/que/que0que.c
445--- a/storage/innodb_plugin/que/que0que.c 2011-07-07 19:38:25.512373167 +0900439+++ b/storage/innodb_plugin/que/que0que.c
446+++ b/storage/innodb_plugin/que/que0que.c 2011-07-07 20:09:02.144331758 +0900
447@@ -1418,6 +1418,12 @@440@@ -1418,6 +1418,12 @@
448 441
449 ut_a(trx->error_state == DB_SUCCESS);442 ut_a(trx->error_state == DB_SUCCESS);
@@ -457,9 +450,8 @@
457 if (reserve_dict_mutex) {450 if (reserve_dict_mutex) {
458 mutex_enter(&dict_sys->mutex);451 mutex_enter(&dict_sys->mutex);
459 }452 }
460diff -ruN a/storage/innodb_plugin/row/row0ins.c b/storage/innodb_plugin/row/row0ins.c453--- a/storage/innodb_plugin/row/row0ins.c
461--- a/storage/innodb_plugin/row/row0ins.c 2011-07-07 19:38:25.925373011 +0900454+++ b/storage/innodb_plugin/row/row0ins.c
462+++ b/storage/innodb_plugin/row/row0ins.c 2011-07-07 20:09:02.147335402 +0900
463@@ -1512,6 +1512,11 @@455@@ -1512,6 +1512,11 @@
464 if (UNIV_LIKELY_NULL(heap)) {456 if (UNIV_LIKELY_NULL(heap)) {
465 mem_heap_free(heap);457 mem_heap_free(heap);
@@ -513,9 +505,8 @@
513 mtr_start(&mtr);505 mtr_start(&mtr);
514 506
515 btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE,507 btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE,
516diff -ruN a/storage/innodb_plugin/row/row0mysql.c b/storage/innodb_plugin/row/row0mysql.c508--- a/storage/innodb_plugin/row/row0mysql.c
517--- a/storage/innodb_plugin/row/row0mysql.c 2011-07-07 19:38:26.139298610 +0900509+++ b/storage/innodb_plugin/row/row0mysql.c
518+++ b/storage/innodb_plugin/row/row0mysql.c 2011-07-07 20:09:02.149334904 +0900
519@@ -1189,6 +1189,7 @@510@@ -1189,6 +1189,7 @@
520 prebuilt->table->stat_n_rows--;511 prebuilt->table->stat_n_rows--;
521 }512 }
@@ -540,9 +531,8 @@
540 row_update_statistics_if_needed(table);531 row_update_statistics_if_needed(table);
541 532
542 return(err);533 return(err);
543diff -ruN a/storage/innodb_plugin/row/row0upd.c b/storage/innodb_plugin/row/row0upd.c534--- a/storage/innodb_plugin/row/row0upd.c
544--- a/storage/innodb_plugin/row/row0upd.c 2011-07-07 19:38:25.530295605 +0900535+++ b/storage/innodb_plugin/row/row0upd.c
545+++ b/storage/innodb_plugin/row/row0upd.c 2011-07-07 20:09:02.152334950 +0900
546@@ -1591,8 +1591,9 @@536@@ -1591,8 +1591,9 @@
547 537
548 mtr_start(&mtr);538 mtr_start(&mtr);
@@ -606,9 +596,8 @@
606 596
607 if (!success) {597 if (!success) {
608 err = DB_RECORD_NOT_FOUND;598 err = DB_RECORD_NOT_FOUND;
609diff -ruN a/storage/innodb_plugin/trx/trx0trx.c b/storage/innodb_plugin/trx/trx0trx.c599--- a/storage/innodb_plugin/trx/trx0trx.c
610--- a/storage/innodb_plugin/trx/trx0trx.c 2011-07-07 19:47:22.358333765 +0900600+++ b/storage/innodb_plugin/trx/trx0trx.c
611+++ b/storage/innodb_plugin/trx/trx0trx.c 2011-07-07 20:09:02.156330704 +0900
612@@ -114,6 +114,8 @@601@@ -114,6 +114,8 @@
613 602
614 trx->flush_log_at_trx_commit_session = 3; /* means to use innodb_flush_log_at_trx_commit value */603 trx->flush_log_at_trx_commit_session = 3; /* means to use innodb_flush_log_at_trx_commit value */
@@ -618,3 +607,162 @@
618 trx->check_foreigns = TRUE;607 trx->check_foreigns = TRUE;
619 trx->check_unique_secondary = TRUE;608 trx->check_unique_secondary = TRUE;
620 609
610--- /dev/null
611+++ b/mysql-test/r/percona_innodb_fake_changes.result
612@@ -0,0 +1,55 @@
613+DROP TABLE IF EXISTS t1;
614+# Checking variables
615+SHOW VARIABLES LIKE 'innodb_fake_changes';
616+Variable_name Value
617+innodb_fake_changes OFF
618+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='innodb_fake_changes';
619+VARIABLE_VALUE
620+OFF
621+SET innodb_fake_changes=1;
622+SHOW VARIABLES LIKE 'innodb_fake_changes';
623+Variable_name Value
624+innodb_fake_changes ON
625+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='innodb_fake_changes';
626+VARIABLE_VALUE
627+ON
628+SET innodb_fake_changes=default;
629+SHOW VARIABLES LIKE 'innodb_fake_changes';
630+Variable_name Value
631+innodb_fake_changes OFF
632+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='innodb_fake_changes';
633+VARIABLE_VALUE
634+OFF
635+# Explicit COMMIT should fail when innodb_fake_changes is enabled
636+# DML should be fine
637+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
638+INSERT INTO t1 VALUES (1);
639+SET autocommit=0;
640+SET innodb_fake_changes=1;
641+BEGIN;
642+INSERT INTO t1 VALUES (2);
643+UPDATE t1 SET a=0;
644+DELETE FROM t1 LIMIT 1;
645+SELECT * FROM t1;
646+a
647+1
648+COMMIT;
649+ERROR HY000: Got error 131 during COMMIT
650+SET innodb_fake_changes=default;
651+DROP TABLE t1;
652+# DDL must result in error
653+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
654+SET autocommit=0;
655+SET innodb_fake_changes=1;
656+BEGIN;
657+CREATE TABLE t2 (a INT) ENGINE=InnoDB;
658+ERROR HY000: Can't create table 'test.t2' (errno: 131)
659+DROP TABLE t1;
660+ERROR 42S02: Unknown table 't1'
661+TRUNCATE TABLE t1;
662+ERROR HY000: Got error 131 during COMMIT
663+ALTER TABLE t1 ENGINE=MyISAM;
664+ERROR HY000: Got error 131 during COMMIT
665+ROLLBACK;
666+SET innodb_fake_changes=default;
667+DROP TABLE t1;
668--- /dev/null
669+++ b/mysql-test/r/percona_innodb_fake_changes_locks.result
670@@ -0,0 +1,19 @@
671+DROP TABLE IF EXISTS t1;
672+# Verifying that X_LOCK not acquired
673+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
674+INSERT INTO t1 VALUES (1);
675+SET autocommit=0;
676+SET innodb_fake_changes=1;
677+BEGIN;
678+SELECT * FROM t1 FOR UPDATE;
679+a
680+1
681+SET innodb_lock_wait_timeout=3;
682+UPDATE t1 SET a=2;
683+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
684+SELECT * FROM t1 LOCK IN SHARE MODE;
685+a
686+1
687+ROLLBACK;
688+SET innodb_fake_changes=default;
689+DROP TABLE t1;
690--- /dev/null
691+++ b/mysql-test/t/percona_innodb_fake_changes.test
692@@ -0,0 +1,49 @@
693+--source include/have_innodb_plugin.inc
694+
695+--disable_warnings
696+DROP TABLE IF EXISTS t1;
697+--enable_warnings
698+
699+
700+--echo # Checking variables
701+SHOW VARIABLES LIKE 'innodb_fake_changes';
702+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='innodb_fake_changes';
703+SET innodb_fake_changes=1;
704+SHOW VARIABLES LIKE 'innodb_fake_changes';
705+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='innodb_fake_changes';
706+SET innodb_fake_changes=default;
707+SHOW VARIABLES LIKE 'innodb_fake_changes';
708+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='innodb_fake_changes';
709+
710+--echo # Explicit COMMIT should fail when innodb_fake_changes is enabled
711+--echo # DML should be fine
712+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
713+INSERT INTO t1 VALUES (1);
714+SET autocommit=0;
715+SET innodb_fake_changes=1;
716+BEGIN;
717+INSERT INTO t1 VALUES (2);
718+UPDATE t1 SET a=0;
719+DELETE FROM t1 LIMIT 1;
720+SELECT * FROM t1;
721+--error 1180
722+COMMIT;
723+SET innodb_fake_changes=default;
724+DROP TABLE t1;
725+
726+--echo # DDL must result in error
727+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
728+SET autocommit=0;
729+SET innodb_fake_changes=1;
730+BEGIN;
731+--error 1005
732+CREATE TABLE t2 (a INT) ENGINE=InnoDB;
733+--error 1051
734+DROP TABLE t1;
735+--error 1180
736+TRUNCATE TABLE t1;
737+--error 1180
738+ALTER TABLE t1 ENGINE=MyISAM;
739+ROLLBACK;
740+SET innodb_fake_changes=default;
741+DROP TABLE t1;
742--- /dev/null
743+++ b/mysql-test/t/percona_innodb_fake_changes_locks.test
744@@ -0,0 +1,24 @@
745+--source include/have_innodb_plugin.inc
746+
747+--disable_warnings
748+DROP TABLE IF EXISTS t1;
749+--enable_warnings
750+
751+--echo # Verifying that X_LOCK not acquired
752+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
753+INSERT INTO t1 VALUES (1);
754+--connect (conn1,localhost,root,,)
755+--connection conn1
756+SET autocommit=0;
757+SET innodb_fake_changes=1;
758+BEGIN;
759+SELECT * FROM t1 FOR UPDATE;
760+--connection default
761+SET innodb_lock_wait_timeout=3;
762+--error 1205
763+UPDATE t1 SET a=2;
764+SELECT * FROM t1 LOCK IN SHARE MODE;
765+--connection conn1
766+ROLLBACK;
767+SET innodb_fake_changes=default;
768+DROP TABLE t1;
621769
=== modified file 'patches/innodb_fast_shutdown.patch'
--- patches/innodb_fast_shutdown.patch 2011-07-30 22:04:31 +0000
+++ patches/innodb_fast_shutdown.patch 2011-10-04 05:52:29 +0000
@@ -159,7 +159,7 @@
159 159
160--- a/storage/innodb_plugin/srv/srv0srv.c160--- a/storage/innodb_plugin/srv/srv0srv.c
161+++ b/storage/innodb_plugin/srv/srv0srv.c161+++ b/storage/innodb_plugin/srv/srv0srv.c
162@@ -708,6 +708,8 @@162@@ -716,6 +716,8 @@
163 163
164 UNIV_INTERN os_event_t srv_lock_timeout_thread_event;164 UNIV_INTERN os_event_t srv_lock_timeout_thread_event;
165 165
@@ -168,7 +168,7 @@
168 UNIV_INTERN srv_sys_t* srv_sys = NULL;168 UNIV_INTERN srv_sys_t* srv_sys = NULL;
169 169
170 /* padding to prevent other memory update hotspots from residing on170 /* padding to prevent other memory update hotspots from residing on
171@@ -1013,6 +1015,7 @@171@@ -1021,6 +1023,7 @@
172 }172 }
173 173
174 srv_lock_timeout_thread_event = os_event_create(NULL);174 srv_lock_timeout_thread_event = os_event_create(NULL);
@@ -176,7 +176,7 @@
176 176
177 for (i = 0; i < SRV_MASTER + 1; i++) {177 for (i = 0; i < SRV_MASTER + 1; i++) {
178 srv_n_threads_active[i] = 0;178 srv_n_threads_active[i] = 0;
179@@ -2240,7 +2243,7 @@179@@ -2248,7 +2251,7 @@
180 /* Wake up every 5 seconds to see if we need to print180 /* Wake up every 5 seconds to see if we need to print
181 monitor information. */181 monitor information. */
182 182
@@ -185,7 +185,7 @@
185 185
186 current_time = time(NULL);186 current_time = time(NULL);
187 187
188@@ -2382,7 +2385,7 @@188@@ -2390,7 +2393,7 @@
189 /* When someone is waiting for a lock, we wake up every second189 /* When someone is waiting for a lock, we wake up every second
190 and check if a timeout has passed for a lock wait */190 and check if a timeout has passed for a lock wait */
191 191
@@ -194,7 +194,7 @@
194 194
195 srv_lock_timeout_active = TRUE;195 srv_lock_timeout_active = TRUE;
196 196
197@@ -2556,7 +2559,7 @@197@@ -2594,7 +2597,7 @@
198 198
199 fflush(stderr);199 fflush(stderr);
200 200
@@ -203,7 +203,7 @@
203 203
204 if (srv_shutdown_state < SRV_SHUTDOWN_CLEANUP) {204 if (srv_shutdown_state < SRV_SHUTDOWN_CLEANUP) {
205 205
206@@ -2600,7 +2603,7 @@206@@ -2638,7 +2641,7 @@
207 last_dump_time = time(NULL);207 last_dump_time = time(NULL);
208 208
209 loop:209 loop:
@@ -212,7 +212,7 @@
212 212
213 if (srv_shutdown_state >= SRV_SHUTDOWN_CLEANUP) {213 if (srv_shutdown_state >= SRV_SHUTDOWN_CLEANUP) {
214 goto exit_func;214 goto exit_func;
215@@ -2783,7 +2786,7 @@215@@ -2821,7 +2824,7 @@
216 if (!skip_sleep) {216 if (!skip_sleep) {
217 if (next_itr_time > cur_time) {217 if (next_itr_time > cur_time) {
218 218
@@ -221,7 +221,7 @@
221 srv_main_sleeps++;221 srv_main_sleeps++;
222 222
223 /*223 /*
224@@ -3490,9 +3493,10 @@224@@ -3528,9 +3531,10 @@
225 mutex_exit(&kernel_mutex);225 mutex_exit(&kernel_mutex);
226 226
227 sleep_ms = 10;227 sleep_ms = 10;
228228
=== renamed file 'innodb_kill_idle_transaction.patch' => 'patches/innodb_kill_idle_transaction.patch'
--- innodb_kill_idle_transaction.patch 2011-07-07 13:02:19 +0000
+++ patches/innodb_kill_idle_transaction.patch 2011-10-04 05:52:29 +0000
@@ -5,9 +5,8 @@
5#!!! notice !!!5#!!! notice !!!
6# Any small change to this file in the main branch6# Any small change to this file in the main branch
7# should be done or reviewed by the maintainer!7# should be done or reviewed by the maintainer!
8diff -ruN a/include/mysql/plugin.h b/include/mysql/plugin.h8--- a/include/mysql/plugin.h
9--- a/include/mysql/plugin.h 2011-07-07 19:38:24.650374103 +09009+++ b/include/mysql/plugin.h
10+++ b/include/mysql/plugin.h 2011-07-07 19:39:44.611713196 +0900
11@@ -845,6 +845,12 @@10@@ -845,6 +845,12 @@
12 */11 */
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,
@@ -21,9 +20,8 @@
21 #ifdef __cplusplus20 #ifdef __cplusplus
22 }21 }
23 #endif22 #endif
24diff -ruN a/include/mysql/plugin.h.pp b/include/mysql/plugin.h.pp23--- a/include/mysql/plugin.h.pp
25--- a/include/mysql/plugin.h.pp 2011-07-07 19:38:24.423414787 +090024+++ b/include/mysql/plugin.h.pp
26+++ b/include/mysql/plugin.h.pp 2011-07-07 19:39:44.615372555 +0900
27@@ -150,3 +150,6 @@25@@ -150,3 +150,6 @@
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);
29 void thd_set_ha_data(void* thd, const struct handlerton *hton,27 void thd_set_ha_data(void* thd, const struct handlerton *hton,
@@ -31,9 +29,8 @@
31+int thd_command(const void* thd);29+int thd_command(const void* thd);
32+long long thd_start_time(const void* thd);30+long long thd_start_time(const void* thd);
33+void thd_kill(void* thd);31+void thd_kill(void* thd);
34diff -ruN a/sql/sql_class.cc b/sql/sql_class.cc32--- a/sql/sql_class.cc
35--- a/sql/sql_class.cc 2011-07-07 19:38:24.999372326 +090033+++ b/sql/sql_class.cc
36+++ b/sql/sql_class.cc 2011-07-07 19:39:44.619370533 +0900
37@@ -468,6 +468,26 @@34@@ -468,6 +468,26 @@
38 return buffer;35 return buffer;
39 }36 }
@@ -61,9 +58,8 @@
61 58
62 /**59 /**
63 Implementation of Drop_table_error_handler::handle_error().60 Implementation of Drop_table_error_handler::handle_error().
64diff -ruN a/storage/innodb_plugin/handler/ha_innodb.cc b/storage/innodb_plugin/handler/ha_innodb.cc61--- a/storage/innodb_plugin/handler/ha_innodb.cc
65--- a/storage/innodb_plugin/handler/ha_innodb.cc 2011-07-07 19:38:26.162373407 +090062+++ b/storage/innodb_plugin/handler/ha_innodb.cc
66+++ b/storage/innodb_plugin/handler/ha_innodb.cc 2011-07-07 19:39:44.625370650 +0900
67@@ -2511,6 +2511,10 @@63@@ -2511,6 +2511,10 @@
68 64
69 innobase_commit_concurrency_init_default();65 innobase_commit_concurrency_init_default();
@@ -148,9 +144,8 @@
148 MYSQL_SYSVAR(data_file_path),144 MYSQL_SYSVAR(data_file_path),
149 MYSQL_SYSVAR(doublewrite_file),145 MYSQL_SYSVAR(doublewrite_file),
150 MYSQL_SYSVAR(data_home_dir),146 MYSQL_SYSVAR(data_home_dir),
151diff -ruN a/storage/innodb_plugin/include/srv0srv.h b/storage/innodb_plugin/include/srv0srv.h147--- a/storage/innodb_plugin/include/srv0srv.h
152--- a/storage/innodb_plugin/include/srv0srv.h 2011-07-07 19:38:26.128372970 +0900148+++ b/storage/innodb_plugin/include/srv0srv.h
153+++ b/storage/innodb_plugin/include/srv0srv.h 2011-07-07 19:39:44.646824971 +0900
154@@ -281,6 +281,7 @@149@@ -281,6 +281,7 @@
155 extern ulint srv_activity_count;150 extern ulint srv_activity_count;
156 extern ulint srv_fatal_semaphore_wait_threshold;151 extern ulint srv_fatal_semaphore_wait_threshold;
@@ -159,9 +154,8 @@
159 154
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,
161 query threads, and lock table: we allocate156 query threads, and lock table: we allocate
162diff -ruN a/storage/innodb_plugin/include/trx0trx.h b/storage/innodb_plugin/include/trx0trx.h157--- a/storage/innodb_plugin/include/trx0trx.h
163--- a/storage/innodb_plugin/include/trx0trx.h 2011-07-07 19:38:25.705377859 +0900158+++ b/storage/innodb_plugin/include/trx0trx.h
164+++ b/storage/innodb_plugin/include/trx0trx.h 2011-07-07 19:39:44.650304314 +0900
165@@ -600,6 +600,8 @@159@@ -600,6 +600,8 @@
166 ulint mysql_process_no;/* since in Linux, 'top' reports160 ulint mysql_process_no;/* since in Linux, 'top' reports
167 process id's and not thread id's, we161 process id's and not thread id's, we
@@ -171,9 +165,8 @@
171 /*------------------------------*/165 /*------------------------------*/
172 ulint n_mysql_tables_in_use; /* number of Innobase tables166 ulint n_mysql_tables_in_use; /* number of Innobase tables
173 used in the processing of the current167 used in the processing of the current
174diff -ruN a/storage/innodb_plugin/srv/srv0srv.c b/storage/innodb_plugin/srv/srv0srv.c168--- a/storage/innodb_plugin/srv/srv0srv.c
175--- a/storage/innodb_plugin/srv/srv0srv.c 2011-07-07 19:38:26.147372081 +0900169+++ b/storage/innodb_plugin/srv/srv0srv.c
176+++ b/storage/innodb_plugin/srv/srv0srv.c 2011-07-07 19:39:44.658303810 +0900
177@@ -86,6 +86,11 @@170@@ -86,6 +86,11 @@
178 #include "trx0i_s.h"171 #include "trx0i_s.h"
179 #include "os0sync.h" /* for HAVE_ATOMIC_BUILTINS */172 #include "os0sync.h" /* for HAVE_ATOMIC_BUILTINS */
@@ -233,9 +226,8 @@
233 /* Flush stderr so that a database user gets the output226 /* Flush stderr so that a database user gets the output
234 to possible MySQL error file */227 to possible MySQL error file */
235 228
236diff -ruN a/storage/innodb_plugin/trx/trx0trx.c b/storage/innodb_plugin/trx/trx0trx.c229--- a/storage/innodb_plugin/trx/trx0trx.c
237--- a/storage/innodb_plugin/trx/trx0trx.c 2011-07-07 19:38:25.723372433 +0900230+++ b/storage/innodb_plugin/trx/trx0trx.c
238+++ b/storage/innodb_plugin/trx/trx0trx.c 2011-07-07 19:39:44.665304098 +0900
239@@ -137,6 +137,9 @@231@@ -137,6 +137,9 @@
240 trx->mysql_relay_log_file_name = "";232 trx->mysql_relay_log_file_name = "";
241 trx->mysql_relay_log_pos = 0;233 trx->mysql_relay_log_pos = 0;
@@ -246,3 +238,160 @@
246 mutex_create(&trx->undo_mutex, SYNC_TRX_UNDO);238 mutex_create(&trx->undo_mutex, SYNC_TRX_UNDO);
247 239
248 trx->rseg = NULL;240 trx->rseg = NULL;
241--- /dev/null
242+++ b/mysql-test/r/percona_innodb_kill_idle_trx.result
243@@ -0,0 +1,41 @@
244+DROP TABLE IF EXISTS t1;
245+SET autocommit=0;
246+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
247+SHOW GLOBAL VARIABLES LIKE 'innodb_kill_idle_transaction';
248+Variable_name Value
249+innodb_kill_idle_transaction 0
250+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_kill_idle_transaction';
251+VARIABLE_NAME VARIABLE_VALUE
252+INNODB_KILL_IDLE_TRANSACTION 0
253+SET GLOBAL innodb_kill_idle_transaction=1;
254+SHOW GLOBAL VARIABLES LIKE 'innodb_kill_idle_transaction';
255+Variable_name Value
256+innodb_kill_idle_transaction 1
257+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_kill_idle_transaction';
258+VARIABLE_NAME VARIABLE_VALUE
259+INNODB_KILL_IDLE_TRANSACTION 1
260+BEGIN;
261+INSERT INTO t1 VALUES (1),(2),(3);
262+COMMIT;
263+SELECT * FROM t1;
264+a
265+1
266+2
267+3
268+BEGIN;
269+INSERT INTO t1 VALUES (4),(5),(6);
270+SELECT * FROM t1;
271+ERROR HY000: MySQL server has gone away
272+SELECT * FROM t1;
273+a
274+1
275+2
276+3
277+DROP TABLE t1;
278+SET GLOBAL innodb_kill_idle_transaction=0;
279+SHOW GLOBAL VARIABLES LIKE 'innodb_kill_idle_transaction';
280+Variable_name Value
281+innodb_kill_idle_transaction 0
282+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_kill_idle_transaction';
283+VARIABLE_NAME VARIABLE_VALUE
284+INNODB_KILL_IDLE_TRANSACTION 0
285--- /dev/null
286+++ b/mysql-test/r/percona_innodb_kill_idle_trx_locks.result
287@@ -0,0 +1,45 @@
288+DROP TABLE IF EXISTS t1;
289+SET autocommit=0;
290+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
291+SHOW GLOBAL VARIABLES LIKE 'innodb_kill_idle_transaction';
292+Variable_name Value
293+innodb_kill_idle_transaction 0
294+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_kill_idle_transaction';
295+VARIABLE_NAME VARIABLE_VALUE
296+INNODB_KILL_IDLE_TRANSACTION 0
297+SET GLOBAL innodb_kill_idle_transaction=5;
298+SHOW GLOBAL VARIABLES LIKE 'innodb_kill_idle_transaction';
299+Variable_name Value
300+innodb_kill_idle_transaction 5
301+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_kill_idle_transaction';
302+VARIABLE_NAME VARIABLE_VALUE
303+INNODB_KILL_IDLE_TRANSACTION 5
304+BEGIN;
305+INSERT INTO t1 VALUES (1),(2),(3);
306+COMMIT;
307+SELECT * FROM t1;
308+a
309+1
310+2
311+3
312+### Locking rows. Lock should be released when idle trx is killed.
313+BEGIN;
314+SELECT * FROM t1 FOR UPDATE;
315+a
316+1
317+2
318+3
319+UPDATE t1 set a=4;
320+SELECT * FROM t1;
321+a
322+4
323+4
324+4
325+DROP TABLE t1;
326+SET GLOBAL innodb_kill_idle_transaction=0;
327+SHOW GLOBAL VARIABLES LIKE 'innodb_kill_idle_transaction';
328+Variable_name Value
329+innodb_kill_idle_transaction 0
330+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_kill_idle_transaction';
331+VARIABLE_NAME VARIABLE_VALUE
332+INNODB_KILL_IDLE_TRANSACTION 0
333--- /dev/null
334+++ b/mysql-test/t/percona_innodb_kill_idle_trx.test
335@@ -0,0 +1,28 @@
336+--source include/have_innodb.inc
337+--disable_warnings
338+DROP TABLE IF EXISTS t1;
339+--enable_warnings
340+
341+SET autocommit=0;
342+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
343+
344+--source include/percona_innodb_kill_idle_trx_show.inc
345+SET GLOBAL innodb_kill_idle_transaction=1;
346+--source include/percona_innodb_kill_idle_trx_show.inc
347+
348+BEGIN;
349+INSERT INTO t1 VALUES (1),(2),(3);
350+COMMIT;
351+SELECT * FROM t1;
352+
353+BEGIN;
354+INSERT INTO t1 VALUES (4),(5),(6);
355+sleep 3;
356+
357+--enable_reconnect
358+--error 2006 --error CR_SERVER_GONE_ERROR
359+SELECT * FROM t1;
360+SELECT * FROM t1;
361+DROP TABLE t1;
362+SET GLOBAL innodb_kill_idle_transaction=0;
363+--source include/percona_innodb_kill_idle_trx_show.inc
364--- /dev/null
365+++ b/mysql-test/t/percona_innodb_kill_idle_trx_locks.test
366@@ -0,0 +1,31 @@
367+--source include/have_innodb.inc
368+--disable_warnings
369+DROP TABLE IF EXISTS t1;
370+--enable_warnings
371+
372+SET autocommit=0;
373+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
374+
375+--source include/percona_innodb_kill_idle_trx_show.inc
376+SET GLOBAL innodb_kill_idle_transaction=5;
377+--source include/percona_innodb_kill_idle_trx_show.inc
378+
379+connect (conn1,localhost,root,,);
380+connection conn1;
381+
382+BEGIN;
383+INSERT INTO t1 VALUES (1),(2),(3);
384+COMMIT;
385+SELECT * FROM t1;
386+
387+--echo ### Locking rows. Lock should be released when idle trx is killed.
388+BEGIN;
389+SELECT * FROM t1 FOR UPDATE;
390+
391+connection default;
392+UPDATE t1 set a=4;
393+
394+SELECT * FROM t1;
395+DROP TABLE t1;
396+SET GLOBAL innodb_kill_idle_transaction=0;
397+--source include/percona_innodb_kill_idle_trx_show.inc
249398
=== modified file 'patches/innodb_split_buf_pool_mutex.patch'
--- patches/innodb_split_buf_pool_mutex.patch 2011-08-09 13:35:34 +0000
+++ patches/innodb_split_buf_pool_mutex.patch 2011-10-04 05:52:29 +0000
@@ -1048,7 +1048,7 @@
1048 ulint fix_type;1048 ulint fix_type;
1049 ibool must_read;1049 ibool must_read;
1050 ulint retries = 0;1050 ulint retries = 0;
1051+ mutex_t* block_mutex;1051+ mutex_t* block_mutex = NULL;
1052 1052
1053 ut_ad(mtr);1053 ut_ad(mtr);
1054 ut_ad(mtr->state == MTR_ACTIVE);1054 ut_ad(mtr->state == MTR_ACTIVE);
10551055
=== modified file 'patches/series'
--- patches/series 2011-09-24 20:18:57 +0000
+++ patches/series 2011-10-04 05:52:29 +0000
@@ -34,6 +34,8 @@
34innodb_show_sys_tables.patch34innodb_show_sys_tables.patch
35innodb_fix_misc.patch35innodb_fix_misc.patch
36innodb_adjust_defaults.patch36innodb_adjust_defaults.patch
37innodb_kill_idle_transaction.patch
38innodb_fake_changes.patch
37mysql-test.diff39mysql-test.diff
38percona-support.patch40percona-support.patch
39innodb_deadlock_count.patch41innodb_deadlock_count.patch

Subscribers

People subscribed via source and target branches