2008-12-03 06:06:00 +01:00
|
|
|
set global innodb_lock_wait_timeout=42;
|
|
|
|
select @@innodb_lock_wait_timeout;
|
|
|
|
@@innodb_lock_wait_timeout
|
|
|
|
42
|
|
|
|
set innodb_lock_wait_timeout=1;
|
|
|
|
select @@innodb_lock_wait_timeout;
|
|
|
|
@@innodb_lock_wait_timeout
|
|
|
|
1
|
|
|
|
select @@innodb_lock_wait_timeout;
|
|
|
|
@@innodb_lock_wait_timeout
|
|
|
|
42
|
|
|
|
set global innodb_lock_wait_timeout=347;
|
|
|
|
select @@innodb_lock_wait_timeout;
|
|
|
|
@@innodb_lock_wait_timeout
|
|
|
|
42
|
|
|
|
set innodb_lock_wait_timeout=1;
|
|
|
|
select @@innodb_lock_wait_timeout;
|
|
|
|
@@innodb_lock_wait_timeout
|
|
|
|
1
|
|
|
|
select @@innodb_lock_wait_timeout;
|
|
|
|
@@innodb_lock_wait_timeout
|
|
|
|
347
|
|
|
|
create table t1(a int primary key)engine=innodb;
|
|
|
|
begin;
|
|
|
|
insert into t1 values(1),(2),(3);
|
2010-01-18 13:56:10 +01:00
|
|
|
set innodb_lock_wait_timeout=5;
|
2008-12-03 06:06:00 +01:00
|
|
|
select * from t1 for update;
|
|
|
|
commit;
|
|
|
|
a
|
|
|
|
1
|
|
|
|
2
|
|
|
|
3
|
|
|
|
begin;
|
|
|
|
insert into t1 values(4);
|
2010-01-18 13:56:10 +01:00
|
|
|
set innodb_lock_wait_timeout=2;
|
|
|
|
set @a= current_timestamp();
|
2008-12-03 06:06:00 +01:00
|
|
|
select * from t1 for update;
|
|
|
|
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
2010-01-18 13:56:10 +01:00
|
|
|
set @b= current_timestamp();
|
|
|
|
set @c= timestampdiff(SECOND, @a, @b);
|
|
|
|
select if(@c >= 1 and @c <= 10, 'OK', concat("NOT OK, time passed=", @c));
|
|
|
|
if(@c >= 1 and @c <= 10, 'OK', concat("NOT OK, time passed=", @c))
|
|
|
|
OK
|
|
|
|
commit;
|
2008-12-03 06:06:00 +01:00
|
|
|
drop table t1;
|
|
|
|
set global innodb_lock_wait_timeout=50;
|