Quantcast
Channel: MySQL Forums - InnoDB
Viewing all articles
Browse latest Browse all 1957

Lock wait timeout exceeded on INSERT (4 replies)

$
0
0
Using MySQL v5.1 with InnoDB, isolation level is READ_COMMITTED, getting this error on an INSERT statement:

SQL Error: 1205, SQLState: 41000
Lock wait timeout exceeded; try restarting transaction

There are 10 threads running with separate connections, all running similar code that performs many INSERTS. Each time I run the test, some number of the 10 fail with the failure on INSERT into one of several tables. The specific tables vary each test case. At the point of failure I have already executed many INSERTs to the table but suddenly one of them fails. At this point it is difficult to determine the precise lock contention that is at work here.

We do not use any explicit table locking. Running with default lock wait timeout of 50 seconds. I have read through all of the MySQL/InnoDB documentation that I can find related to isolation levels and locking. I do not understand which types of locks would be causing contention when multiple threads/connections are inserting to the same table. At the READ_COMMITTED level, I would not expect any lock contention.

Thinking the problem might be SELECTs from other threads creating implicit locks that blocked the INSERTs, I tried enabling the innodb_locks_unsafe_for_binlog option in case the problem was related to Next-Key index record locks. Enabling this option did not make any difference.

Can someone provide explanation of MySQL/InnoDB locking behavior that could cause this concurrency issue or point me to documentation of the same?

Thanks,

Greg

Viewing all articles
Browse latest Browse all 1957

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>