Loading innobase/include/row0mysql.h +2 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ Created 9/17/2000 Heikki Tuuri #include "btr0pcur.h" #include "trx0types.h" extern ibool row_rollback_on_timeout; typedef struct row_prebuilt_struct row_prebuilt_t; /*********************************************************************** Loading innobase/row/row0mysql.c +10 −1 Original line number Diff line number Diff line Loading @@ -35,6 +35,9 @@ Created 9/17/2000 Heikki Tuuri /* A dummy variable used to fool the compiler */ ibool row_mysql_identically_false = FALSE; /* Provide optional 4.x backwards compatibility for 5.0 and above */ ibool row_rollback_on_timeout = FALSE; /* List of tables we should drop in background. ALTER TABLE in MySQL requires that the table handler can drop the table in background when there are no queries to it any more. Protected by the kernel mutex. */ Loading Loading @@ -514,7 +517,9 @@ row_mysql_handle_errors( return(TRUE); } else if (err == DB_DEADLOCK || err == DB_LOCK_TABLE_FULL) { || err == DB_LOCK_TABLE_FULL || (err == DB_LOCK_WAIT_TIMEOUT && row_rollback_on_timeout)) { /* Roll back the whole transaction; this resolution was added to version 3.23.43 */ Loading @@ -522,6 +527,10 @@ row_mysql_handle_errors( } else if (err == DB_OUT_OF_FILE_SPACE || err == DB_LOCK_WAIT_TIMEOUT) { ut_ad(!(err == DB_LOCK_WAIT_TIMEOUT && row_rollback_on_timeout)); if (savept) { /* Roll back the latest, possibly incomplete insertion or update */ Loading mysql-test/include/innodb_rollback_on_timeout.inc 0 → 100644 +37 −0 Original line number Diff line number Diff line # # Bug #24200: Provide backwards compatibility mode for 4.x "rollback on # transaction timeout" # show variables like 'innodb_rollback_on_timeout'; create table t1 (a int unsigned not null primary key) engine = innodb; insert into t1 values (1); commit; connect (con1,localhost,root,,); connect (con2,localhost,root,,); connection con2; begin work; insert into t1 values (2); select * from t1; connection con1; begin work; insert into t1 values (5); select * from t1; # Lock wait timeout set to 2 seconds in <THIS TEST>-master.opt; this # statement will time out; in 5.0.13+, it will not roll back transaction. --error ER_LOCK_WAIT_TIMEOUT insert into t1 values (2); # On 5.0.13+, this should give ==> 1, 5 select * from t1; commit; connection con2; select * from t1; commit; connection default; select * from t1; drop table t1; disconnect con1; disconnect con2; mysql-test/r/innodb_mysql.result +36 −0 Original line number Diff line number Diff line Loading @@ -383,4 +383,40 @@ EXPLAIN SELECT SQL_BIG_RESULT b, SUM(c) FROM t1 GROUP BY b; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 128 Using filesort DROP TABLE t1; show variables like 'innodb_rollback_on_timeout'; Variable_name Value innodb_rollback_on_timeout OFF create table t1 (a int unsigned not null primary key) engine = innodb; insert into t1 values (1); commit; begin work; insert into t1 values (2); select * from t1; a 1 2 begin work; insert into t1 values (5); select * from t1; a 1 5 insert into t1 values (2); ERROR HY000: Lock wait timeout exceeded; try restarting transaction select * from t1; a 1 5 commit; select * from t1; a 1 2 commit; select * from t1; a 1 2 5 drop table t1; End of 5.0 tests mysql-test/r/innodb_timeout_rollback.result 0 → 100644 +35 −0 Original line number Diff line number Diff line show variables like 'innodb_rollback_on_timeout'; Variable_name Value innodb_rollback_on_timeout ON create table t1 (a int unsigned not null primary key) engine = innodb; insert into t1 values (1); commit; begin work; insert into t1 values (2); select * from t1; a 1 2 begin work; insert into t1 values (5); select * from t1; a 1 5 insert into t1 values (2); ERROR HY000: Lock wait timeout exceeded; try restarting transaction select * from t1; a 1 commit; select * from t1; a 1 2 commit; select * from t1; a 1 2 drop table t1; End of 5.0 tests Loading
innobase/include/row0mysql.h +2 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ Created 9/17/2000 Heikki Tuuri #include "btr0pcur.h" #include "trx0types.h" extern ibool row_rollback_on_timeout; typedef struct row_prebuilt_struct row_prebuilt_t; /*********************************************************************** Loading
innobase/row/row0mysql.c +10 −1 Original line number Diff line number Diff line Loading @@ -35,6 +35,9 @@ Created 9/17/2000 Heikki Tuuri /* A dummy variable used to fool the compiler */ ibool row_mysql_identically_false = FALSE; /* Provide optional 4.x backwards compatibility for 5.0 and above */ ibool row_rollback_on_timeout = FALSE; /* List of tables we should drop in background. ALTER TABLE in MySQL requires that the table handler can drop the table in background when there are no queries to it any more. Protected by the kernel mutex. */ Loading Loading @@ -514,7 +517,9 @@ row_mysql_handle_errors( return(TRUE); } else if (err == DB_DEADLOCK || err == DB_LOCK_TABLE_FULL) { || err == DB_LOCK_TABLE_FULL || (err == DB_LOCK_WAIT_TIMEOUT && row_rollback_on_timeout)) { /* Roll back the whole transaction; this resolution was added to version 3.23.43 */ Loading @@ -522,6 +527,10 @@ row_mysql_handle_errors( } else if (err == DB_OUT_OF_FILE_SPACE || err == DB_LOCK_WAIT_TIMEOUT) { ut_ad(!(err == DB_LOCK_WAIT_TIMEOUT && row_rollback_on_timeout)); if (savept) { /* Roll back the latest, possibly incomplete insertion or update */ Loading
mysql-test/include/innodb_rollback_on_timeout.inc 0 → 100644 +37 −0 Original line number Diff line number Diff line # # Bug #24200: Provide backwards compatibility mode for 4.x "rollback on # transaction timeout" # show variables like 'innodb_rollback_on_timeout'; create table t1 (a int unsigned not null primary key) engine = innodb; insert into t1 values (1); commit; connect (con1,localhost,root,,); connect (con2,localhost,root,,); connection con2; begin work; insert into t1 values (2); select * from t1; connection con1; begin work; insert into t1 values (5); select * from t1; # Lock wait timeout set to 2 seconds in <THIS TEST>-master.opt; this # statement will time out; in 5.0.13+, it will not roll back transaction. --error ER_LOCK_WAIT_TIMEOUT insert into t1 values (2); # On 5.0.13+, this should give ==> 1, 5 select * from t1; commit; connection con2; select * from t1; commit; connection default; select * from t1; drop table t1; disconnect con1; disconnect con2;
mysql-test/r/innodb_mysql.result +36 −0 Original line number Diff line number Diff line Loading @@ -383,4 +383,40 @@ EXPLAIN SELECT SQL_BIG_RESULT b, SUM(c) FROM t1 GROUP BY b; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 128 Using filesort DROP TABLE t1; show variables like 'innodb_rollback_on_timeout'; Variable_name Value innodb_rollback_on_timeout OFF create table t1 (a int unsigned not null primary key) engine = innodb; insert into t1 values (1); commit; begin work; insert into t1 values (2); select * from t1; a 1 2 begin work; insert into t1 values (5); select * from t1; a 1 5 insert into t1 values (2); ERROR HY000: Lock wait timeout exceeded; try restarting transaction select * from t1; a 1 5 commit; select * from t1; a 1 2 commit; select * from t1; a 1 2 5 drop table t1; End of 5.0 tests
mysql-test/r/innodb_timeout_rollback.result 0 → 100644 +35 −0 Original line number Diff line number Diff line show variables like 'innodb_rollback_on_timeout'; Variable_name Value innodb_rollback_on_timeout ON create table t1 (a int unsigned not null primary key) engine = innodb; insert into t1 values (1); commit; begin work; insert into t1 values (2); select * from t1; a 1 2 begin work; insert into t1 values (5); select * from t1; a 1 5 insert into t1 values (2); ERROR HY000: Lock wait timeout exceeded; try restarting transaction select * from t1; a 1 commit; select * from t1; a 1 2 commit; select * from t1; a 1 2 drop table t1; End of 5.0 tests