Loading mysql-test/r/innodb.result +141 −35 Original line number Diff line number Diff line Loading @@ -1295,22 +1295,14 @@ insert into t2 (a) select b from t1; insert into t1 (a) select b from t2; insert into t2 (a) select b from t1; insert into t1 (a) select b from t2; insert into t2 (a) select b from t1; insert into t1 (a) select b from t2; insert into t2 (a) select b from t1; insert into t1 (a) select b from t2; insert into t2 (a) select b from t1; insert into t1 (a) select b from t2; insert into t2 (a) select b from t1; insert into t1 (a) select b from t2; select count(*) from t1; count(*) 29267 explain select * from t1 where c between 1 and 10000; 623 explain select * from t1 where c between 1 and 2500; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range c c 5 NULL # Using where update t1 set c=a; explain select * from t1 where c between 1 and 10000; explain select * from t1 where c between 1 and 2500; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL c NULL NULL NULL # Using where drop table t1,t2; Loading Loading @@ -1775,21 +1767,6 @@ select count(*) from t1 where x = 18446744073709551601; count(*) 1 drop table t1; show status like "Innodb_buffer_pool_pages_total"; Variable_name Value Innodb_buffer_pool_pages_total 512 show status like "Innodb_page_size"; Variable_name Value Innodb_page_size 16384 show status like "Innodb_rows_deleted"; Variable_name Value Innodb_rows_deleted 2070 show status like "Innodb_rows_inserted"; Variable_name Value Innodb_rows_inserted 31727 show status like "Innodb_rows_updated"; Variable_name Value Innodb_rows_updated 29530 show status like "Innodb_row_lock_waits"; Variable_name Value Innodb_row_lock_waits 0 Loading Loading @@ -3233,15 +3210,6 @@ drop trigger t2t; drop trigger t3t; drop trigger t4t; drop table t1, t2, t3, t4, t5; create table t1(a date) engine=innodb; create table t2(a date, key(a)) engine=innodb; insert into t1 values('2005-10-01'); insert into t2 values('2005-10-01'); select * from t1, t2 where t2.a between t1.a - interval 2 day and t1.a + interval 2 day; a a 2005-10-01 2005-10-01 drop table t1, t2; CREATE TABLE t1 ( field1 varchar(8) NOT NULL DEFAULT '', field2 varchar(8) NOT NULL DEFAULT '', Loading Loading @@ -3291,3 +3259,141 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `c2` (`c2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t1, t2; create table t1(a date) engine=innodb; create table t2(a date, key(a)) engine=innodb; insert into t1 values('2005-10-01'); insert into t2 values('2005-10-01'); select * from t1, t2 where t2.a between t1.a - interval 2 day and t1.a + interval 2 day; a a 2005-10-01 2005-10-01 drop table t1, t2; create table t1 (id int not null, f_id int not null, f int not null, primary key(f_id, id)) engine=innodb; create table t2 (id int not null,s_id int not null,s varchar(200), primary key(id)) engine=innodb; INSERT INTO t1 VALUES (8, 1, 3); INSERT INTO t1 VALUES (1, 2, 1); INSERT INTO t2 VALUES (1, 0, ''); INSERT INTO t2 VALUES (8, 1, ''); commit; DELETE ml.* FROM t1 AS ml LEFT JOIN t2 AS mm ON (mm.id=ml.id) WHERE mm.id IS NULL; select ml.* from t1 as ml left join t2 as mm on (mm.id=ml.id) where mm.id is null lock in share mode; id f_id f drop table t1,t2; create table t1(a int not null, b int, primary key(a)) engine=innodb; insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3); commit; set autocommit = 0; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; update t1 set b = 5 where b = 1; set autocommit = 0; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; select * from t1 where a = 7 and b = 3 for update; a b 7 3 commit; commit; drop table t1; create table t1(a int not null, b int, primary key(a)) engine=innodb; insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2); commit; set autocommit = 0; select * from t1 lock in share mode; a b 1 1 2 2 3 1 4 2 5 1 6 2 update t1 set b = 5 where b = 1; set autocommit = 0; select * from t1 where a = 2 and b = 2 for update; ERROR HY000: Lock wait timeout exceeded; try restarting transaction commit; commit; drop table t1; create table t1(a int not null, b int, primary key(a)) engine=innodb; insert into t1 values (1,2),(5,3),(4,2); create table t2(d int not null, e int, primary key(d)) engine=innodb; insert into t2 values (8,6),(12,1),(3,1); commit; set autocommit = 0; select * from t2 for update; d e 3 1 8 6 12 1 set autocommit = 0; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; insert into t1 select * from t2; update t1 set b = (select e from t2 where a = d); create table t3(d int not null, e int, primary key(d)) engine=innodb select * from t2; commit; commit; drop table t1, t2, t3; create table t1(a int not null, b int, primary key(a)) engine=innodb; insert into t1 values (1,2),(5,3),(4,2); create table t2(a int not null, b int, primary key(a)) engine=innodb; insert into t2 values (8,6),(12,1),(3,1); create table t3(d int not null, b int, primary key(d)) engine=innodb; insert into t3 values (8,6),(12,1),(3,1); create table t5(a int not null, b int, primary key(a)) engine=innodb; insert into t5 values (1,2),(5,3),(4,2); create table t6(d int not null, e int, primary key(d)) engine=innodb; insert into t6 values (8,6),(12,1),(3,1); create table t8(a int not null, b int, primary key(a)) engine=innodb; insert into t8 values (1,2),(5,3),(4,2); create table t9(d int not null, e int, primary key(d)) engine=innodb; insert into t9 values (8,6),(12,1),(3,1); commit; set autocommit = 0; select * from t2 for update; a b 3 1 8 6 12 1 set autocommit = 0; SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; insert into t1 select * from t2; set autocommit = 0; SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; update t3 set b = (select b from t2 where a = d); set autocommit = 0; SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; create table t4(a int not null, b int, primary key(a)) engine=innodb select * from t2; set autocommit = 0; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; insert into t5 (select * from t2 lock in share mode); set autocommit = 0; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; update t6 set e = (select b from t2 where a = d lock in share mode); set autocommit = 0; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; create table t7(a int not null, b int, primary key(a)) engine=innodb select * from t2 lock in share mode; set autocommit = 0; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; insert into t8 (select * from t2 for update); set autocommit = 0; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; update t9 set e = (select b from t2 where a = d for update); set autocommit = 0; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; create table t10(a int not null, b int, primary key(a)) engine=innodb select * from t2 for update; ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction commit; drop table t1, t2, t3, t5, t6, t8, t9; CREATE TABLE t1 (DB_ROW_ID int) engine=innodb; ERROR HY000: Can't create table 'test.t1' (errno: -1) mysql-test/r/innodb_unsafe_binlog.result +86 −1 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ where mm.id is null lock in share mode; id f_id f drop table t1,t2; create table t1(a int not null, b int, primary key(a)) engine=innodb; insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2); insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3); commit; set autocommit = 0; select * from t1 lock in share mode; Loading @@ -26,6 +26,7 @@ a b 4 2 5 1 6 2 7 3 update t1 set b = 5 where b = 1; set autocommit = 0; select * from t1 where a = 2 and b = 2 for update; Loading @@ -33,3 +34,87 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction commit; commit; drop table t1; create table t1(a int not null, b int, primary key(a)) engine=innodb; insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3); commit; set autocommit = 0; update t1 set b = 5 where b = 1; set autocommit = 0; select * from t1 where a = 7 and b = 3 for update; a b 7 3 commit; commit; drop table t1; create table t1(a int not null, b int, primary key(a)) engine=innodb; insert into t1 values (1,2),(5,3),(4,2); create table t2(d int not null, e int, primary key(d)) engine=innodb; insert into t2 values (8,6),(12,1),(3,1); commit; set autocommit = 0; select * from t2 for update; d e 3 1 8 6 12 1 set autocommit = 0; insert into t1 select * from t2; update t1 set b = (select e from t2 where a = d); create table t3(d int not null, e int, primary key(d)) engine=innodb select * from t2; commit; commit; drop table t1, t2, t3; create table t1(a int not null, b int, primary key(a)) engine=innodb; insert into t1 values (1,2),(5,3),(4,2); create table t2(a int not null, b int, primary key(a)) engine=innodb; insert into t2 values (8,6),(12,1),(3,1); create table t3(d int not null, b int, primary key(d)) engine=innodb; insert into t3 values (8,6),(12,1),(3,1); create table t5(a int not null, b int, primary key(a)) engine=innodb; insert into t5 values (1,2),(5,3),(4,2); create table t6(d int not null, e int, primary key(d)) engine=innodb; insert into t6 values (8,6),(12,1),(3,1); create table t8(a int not null, b int, primary key(a)) engine=innodb; insert into t8 values (1,2),(5,3),(4,2); create table t9(d int not null, e int, primary key(d)) engine=innodb; insert into t9 values (8,6),(12,1),(3,1); commit; set autocommit = 0; select * from t2 for update; a b 3 1 8 6 12 1 set autocommit = 0; SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; insert into t1 select * from t2; set autocommit = 0; SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; update t3 set b = (select b from t2 where a = d); set autocommit = 0; SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; create table t4(a int not null, b int, primary key(a)) engine=innodb select * from t2; set autocommit = 0; insert into t5 (select * from t2 lock in share mode); set autocommit = 0; update t6 set e = (select b from t2 where a = d lock in share mode); set autocommit = 0; create table t7(a int not null, b int, primary key(a)) engine=innodb select * from t2 lock in share mode; set autocommit = 0; insert into t8 (select * from t2 for update); set autocommit = 0; update t9 set e = (select b from t2 where a = d for update); set autocommit = 0; create table t10(a int not null, b int, primary key(a)) engine=innodb select * from t2 for update; ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction commit; drop table t1, t2, t3, t5, t6, t8, t9; mysql-test/r/status.result +20 −0 Original line number Diff line number Diff line Loading @@ -23,3 +23,23 @@ select 1; show status like 'last_query_cost'; Variable_name Value Last_query_cost 0.000000 FLUSH STATUS; SHOW STATUS LIKE 'max_used_connections'; Variable_name Value Max_used_connections 1 SET @save_thread_cache_size=@@thread_cache_size; SET GLOBAL thread_cache_size=3; SHOW STATUS LIKE 'max_used_connections'; Variable_name Value Max_used_connections 3 FLUSH STATUS; SHOW STATUS LIKE 'max_used_connections'; Variable_name Value Max_used_connections 2 SHOW STATUS LIKE 'max_used_connections'; Variable_name Value Max_used_connections 3 SHOW STATUS LIKE 'max_used_connections'; Variable_name Value Max_used_connections 4 SET GLOBAL thread_cache_size=@save_thread_cache_size; mysql-test/r/trigger.result +13 −0 Original line number Diff line number Diff line Loading @@ -952,3 +952,16 @@ load data infile '../std_data_ln/words.dat' into table t1 (a) set b:= f1(); drop table t1; drop function f1; drop function f2; DROP TABLE IF EXISTS t1; CREATE TABLE t1 ( conn_id INT, trigger_conn_id INT ); CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET NEW.trigger_conn_id = CONNECTION_ID(); INSERT INTO t1 (conn_id, trigger_conn_id) VALUES (CONNECTION_ID(), -1); INSERT INTO t1 (conn_id, trigger_conn_id) VALUES (CONNECTION_ID(), -1); SELECT * FROM t1 WHERE conn_id != trigger_conn_id; conn_id trigger_conn_id DROP TRIGGER t1_bi; DROP TABLE t1; mysql-test/t/innodb-master.opt +1 −1 Original line number Diff line number Diff line --binlog_cache_size=32768 --binlog_cache_size=32768 --innodb_lock_wait_timeout=1 Loading
mysql-test/r/innodb.result +141 −35 Original line number Diff line number Diff line Loading @@ -1295,22 +1295,14 @@ insert into t2 (a) select b from t1; insert into t1 (a) select b from t2; insert into t2 (a) select b from t1; insert into t1 (a) select b from t2; insert into t2 (a) select b from t1; insert into t1 (a) select b from t2; insert into t2 (a) select b from t1; insert into t1 (a) select b from t2; insert into t2 (a) select b from t1; insert into t1 (a) select b from t2; insert into t2 (a) select b from t1; insert into t1 (a) select b from t2; select count(*) from t1; count(*) 29267 explain select * from t1 where c between 1 and 10000; 623 explain select * from t1 where c between 1 and 2500; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range c c 5 NULL # Using where update t1 set c=a; explain select * from t1 where c between 1 and 10000; explain select * from t1 where c between 1 and 2500; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL c NULL NULL NULL # Using where drop table t1,t2; Loading Loading @@ -1775,21 +1767,6 @@ select count(*) from t1 where x = 18446744073709551601; count(*) 1 drop table t1; show status like "Innodb_buffer_pool_pages_total"; Variable_name Value Innodb_buffer_pool_pages_total 512 show status like "Innodb_page_size"; Variable_name Value Innodb_page_size 16384 show status like "Innodb_rows_deleted"; Variable_name Value Innodb_rows_deleted 2070 show status like "Innodb_rows_inserted"; Variable_name Value Innodb_rows_inserted 31727 show status like "Innodb_rows_updated"; Variable_name Value Innodb_rows_updated 29530 show status like "Innodb_row_lock_waits"; Variable_name Value Innodb_row_lock_waits 0 Loading Loading @@ -3233,15 +3210,6 @@ drop trigger t2t; drop trigger t3t; drop trigger t4t; drop table t1, t2, t3, t4, t5; create table t1(a date) engine=innodb; create table t2(a date, key(a)) engine=innodb; insert into t1 values('2005-10-01'); insert into t2 values('2005-10-01'); select * from t1, t2 where t2.a between t1.a - interval 2 day and t1.a + interval 2 day; a a 2005-10-01 2005-10-01 drop table t1, t2; CREATE TABLE t1 ( field1 varchar(8) NOT NULL DEFAULT '', field2 varchar(8) NOT NULL DEFAULT '', Loading Loading @@ -3291,3 +3259,141 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `c2` (`c2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t1, t2; create table t1(a date) engine=innodb; create table t2(a date, key(a)) engine=innodb; insert into t1 values('2005-10-01'); insert into t2 values('2005-10-01'); select * from t1, t2 where t2.a between t1.a - interval 2 day and t1.a + interval 2 day; a a 2005-10-01 2005-10-01 drop table t1, t2; create table t1 (id int not null, f_id int not null, f int not null, primary key(f_id, id)) engine=innodb; create table t2 (id int not null,s_id int not null,s varchar(200), primary key(id)) engine=innodb; INSERT INTO t1 VALUES (8, 1, 3); INSERT INTO t1 VALUES (1, 2, 1); INSERT INTO t2 VALUES (1, 0, ''); INSERT INTO t2 VALUES (8, 1, ''); commit; DELETE ml.* FROM t1 AS ml LEFT JOIN t2 AS mm ON (mm.id=ml.id) WHERE mm.id IS NULL; select ml.* from t1 as ml left join t2 as mm on (mm.id=ml.id) where mm.id is null lock in share mode; id f_id f drop table t1,t2; create table t1(a int not null, b int, primary key(a)) engine=innodb; insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3); commit; set autocommit = 0; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; update t1 set b = 5 where b = 1; set autocommit = 0; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; select * from t1 where a = 7 and b = 3 for update; a b 7 3 commit; commit; drop table t1; create table t1(a int not null, b int, primary key(a)) engine=innodb; insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2); commit; set autocommit = 0; select * from t1 lock in share mode; a b 1 1 2 2 3 1 4 2 5 1 6 2 update t1 set b = 5 where b = 1; set autocommit = 0; select * from t1 where a = 2 and b = 2 for update; ERROR HY000: Lock wait timeout exceeded; try restarting transaction commit; commit; drop table t1; create table t1(a int not null, b int, primary key(a)) engine=innodb; insert into t1 values (1,2),(5,3),(4,2); create table t2(d int not null, e int, primary key(d)) engine=innodb; insert into t2 values (8,6),(12,1),(3,1); commit; set autocommit = 0; select * from t2 for update; d e 3 1 8 6 12 1 set autocommit = 0; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; insert into t1 select * from t2; update t1 set b = (select e from t2 where a = d); create table t3(d int not null, e int, primary key(d)) engine=innodb select * from t2; commit; commit; drop table t1, t2, t3; create table t1(a int not null, b int, primary key(a)) engine=innodb; insert into t1 values (1,2),(5,3),(4,2); create table t2(a int not null, b int, primary key(a)) engine=innodb; insert into t2 values (8,6),(12,1),(3,1); create table t3(d int not null, b int, primary key(d)) engine=innodb; insert into t3 values (8,6),(12,1),(3,1); create table t5(a int not null, b int, primary key(a)) engine=innodb; insert into t5 values (1,2),(5,3),(4,2); create table t6(d int not null, e int, primary key(d)) engine=innodb; insert into t6 values (8,6),(12,1),(3,1); create table t8(a int not null, b int, primary key(a)) engine=innodb; insert into t8 values (1,2),(5,3),(4,2); create table t9(d int not null, e int, primary key(d)) engine=innodb; insert into t9 values (8,6),(12,1),(3,1); commit; set autocommit = 0; select * from t2 for update; a b 3 1 8 6 12 1 set autocommit = 0; SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; insert into t1 select * from t2; set autocommit = 0; SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; update t3 set b = (select b from t2 where a = d); set autocommit = 0; SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; create table t4(a int not null, b int, primary key(a)) engine=innodb select * from t2; set autocommit = 0; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; insert into t5 (select * from t2 lock in share mode); set autocommit = 0; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; update t6 set e = (select b from t2 where a = d lock in share mode); set autocommit = 0; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; create table t7(a int not null, b int, primary key(a)) engine=innodb select * from t2 lock in share mode; set autocommit = 0; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; insert into t8 (select * from t2 for update); set autocommit = 0; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; update t9 set e = (select b from t2 where a = d for update); set autocommit = 0; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; create table t10(a int not null, b int, primary key(a)) engine=innodb select * from t2 for update; ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction commit; drop table t1, t2, t3, t5, t6, t8, t9; CREATE TABLE t1 (DB_ROW_ID int) engine=innodb; ERROR HY000: Can't create table 'test.t1' (errno: -1)
mysql-test/r/innodb_unsafe_binlog.result +86 −1 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ where mm.id is null lock in share mode; id f_id f drop table t1,t2; create table t1(a int not null, b int, primary key(a)) engine=innodb; insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2); insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3); commit; set autocommit = 0; select * from t1 lock in share mode; Loading @@ -26,6 +26,7 @@ a b 4 2 5 1 6 2 7 3 update t1 set b = 5 where b = 1; set autocommit = 0; select * from t1 where a = 2 and b = 2 for update; Loading @@ -33,3 +34,87 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction commit; commit; drop table t1; create table t1(a int not null, b int, primary key(a)) engine=innodb; insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3); commit; set autocommit = 0; update t1 set b = 5 where b = 1; set autocommit = 0; select * from t1 where a = 7 and b = 3 for update; a b 7 3 commit; commit; drop table t1; create table t1(a int not null, b int, primary key(a)) engine=innodb; insert into t1 values (1,2),(5,3),(4,2); create table t2(d int not null, e int, primary key(d)) engine=innodb; insert into t2 values (8,6),(12,1),(3,1); commit; set autocommit = 0; select * from t2 for update; d e 3 1 8 6 12 1 set autocommit = 0; insert into t1 select * from t2; update t1 set b = (select e from t2 where a = d); create table t3(d int not null, e int, primary key(d)) engine=innodb select * from t2; commit; commit; drop table t1, t2, t3; create table t1(a int not null, b int, primary key(a)) engine=innodb; insert into t1 values (1,2),(5,3),(4,2); create table t2(a int not null, b int, primary key(a)) engine=innodb; insert into t2 values (8,6),(12,1),(3,1); create table t3(d int not null, b int, primary key(d)) engine=innodb; insert into t3 values (8,6),(12,1),(3,1); create table t5(a int not null, b int, primary key(a)) engine=innodb; insert into t5 values (1,2),(5,3),(4,2); create table t6(d int not null, e int, primary key(d)) engine=innodb; insert into t6 values (8,6),(12,1),(3,1); create table t8(a int not null, b int, primary key(a)) engine=innodb; insert into t8 values (1,2),(5,3),(4,2); create table t9(d int not null, e int, primary key(d)) engine=innodb; insert into t9 values (8,6),(12,1),(3,1); commit; set autocommit = 0; select * from t2 for update; a b 3 1 8 6 12 1 set autocommit = 0; SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; insert into t1 select * from t2; set autocommit = 0; SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; update t3 set b = (select b from t2 where a = d); set autocommit = 0; SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; create table t4(a int not null, b int, primary key(a)) engine=innodb select * from t2; set autocommit = 0; insert into t5 (select * from t2 lock in share mode); set autocommit = 0; update t6 set e = (select b from t2 where a = d lock in share mode); set autocommit = 0; create table t7(a int not null, b int, primary key(a)) engine=innodb select * from t2 lock in share mode; set autocommit = 0; insert into t8 (select * from t2 for update); set autocommit = 0; update t9 set e = (select b from t2 where a = d for update); set autocommit = 0; create table t10(a int not null, b int, primary key(a)) engine=innodb select * from t2 for update; ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction commit; drop table t1, t2, t3, t5, t6, t8, t9;
mysql-test/r/status.result +20 −0 Original line number Diff line number Diff line Loading @@ -23,3 +23,23 @@ select 1; show status like 'last_query_cost'; Variable_name Value Last_query_cost 0.000000 FLUSH STATUS; SHOW STATUS LIKE 'max_used_connections'; Variable_name Value Max_used_connections 1 SET @save_thread_cache_size=@@thread_cache_size; SET GLOBAL thread_cache_size=3; SHOW STATUS LIKE 'max_used_connections'; Variable_name Value Max_used_connections 3 FLUSH STATUS; SHOW STATUS LIKE 'max_used_connections'; Variable_name Value Max_used_connections 2 SHOW STATUS LIKE 'max_used_connections'; Variable_name Value Max_used_connections 3 SHOW STATUS LIKE 'max_used_connections'; Variable_name Value Max_used_connections 4 SET GLOBAL thread_cache_size=@save_thread_cache_size;
mysql-test/r/trigger.result +13 −0 Original line number Diff line number Diff line Loading @@ -952,3 +952,16 @@ load data infile '../std_data_ln/words.dat' into table t1 (a) set b:= f1(); drop table t1; drop function f1; drop function f2; DROP TABLE IF EXISTS t1; CREATE TABLE t1 ( conn_id INT, trigger_conn_id INT ); CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET NEW.trigger_conn_id = CONNECTION_ID(); INSERT INTO t1 (conn_id, trigger_conn_id) VALUES (CONNECTION_ID(), -1); INSERT INTO t1 (conn_id, trigger_conn_id) VALUES (CONNECTION_ID(), -1); SELECT * FROM t1 WHERE conn_id != trigger_conn_id; conn_id trigger_conn_id DROP TRIGGER t1_bi; DROP TABLE t1;
mysql-test/t/innodb-master.opt +1 −1 Original line number Diff line number Diff line --binlog_cache_size=32768 --binlog_cache_size=32768 --innodb_lock_wait_timeout=1