Bug #29678 | Table lock wait timeout in all case | ||
---|---|---|---|
Submitted: | 10 Jul 2007 6:12 | Modified: | 2 Feb 2013 14:23 |
Reporter: | Yuan WANG | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Locking | Severity: | S4 (Feature request) |
Version: | 5.0.44 | OS: | Linux |
Assigned to: | CPU Architecture: | Any | |
Tags: | lock |
[10 Jul 2007 6:12]
Yuan WANG
[30 Nov 2011 3:24]
Raghavendra Prabhu
This seems to be implemented by looking at the code for wait_for_lock (which calls my_cond_timedwait which in turn calls the pthread_cond_timedwait), however, the default value for lock_wait_timeout is 31536000 , so it will wait for a very long time (a year) before timing out.
[2 Feb 2013 14:23]
MySQL Verification Team
lock_wait_timeout solves this. Connection 1: --------------- mysql> create table t1(a int)engine=innodb; Query OK, 0 rows affected (0.01 sec) mysql> lock table t1 read; Query OK, 0 rows affected (0.00 sec) Connection2: -------------- mysql> set lock_wait_timeout=10; Query OK, 0 rows affected (0.00 sec) mysql> insert into t1 values (1); ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction mysql> http://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html#sysvar_lock_wait_timeo... http://dev.mysql.com/doc/refman/5.5/en/metadata-locking.html