I'm using innoDB on AWS. I keep getting a ton of the following messages in my logs:
Waiting for table level lock
I thought innoDB only did row-level locks. I don't have any lock tables in my code. Does anyone have any idea why this would happen?
I'm using innoDB on AWS. I keep getting a ton of the following messages in my logs:
Waiting for table level lock
I thought innoDB only did row-level locks. I don't have any lock tables in my code. Does anyone have any idea why this would happen?
There some situations under which innoDB will do table locks (like AUTO-INC) see this article in this regard, and see if applies to you case: InnoDB table locks
Also check if set or set innodb_table_locks=0
in MySQL configuration.Refer here for the documentation: InnoDB Startup Options and System Variables
There are certain reasons when InnoDB table locks comes into picture:
1) InnoDB is aware of table locks if
innodb_table_locks = 1
(the default) andautocommit = 0
, and the MySQL layer above InnoDB knows about row-level locks.You should set
innodb_table_locks=0
and restart MySQL server.2) While initializing a previously specified
AUTO_INCREMENT
column on a table, InnoDB sets an exclusive lock on the end of the index associated with the AUTO_INCREMENT column. While accessing the auto-increment counter, InnoDB uses a specificAUTO-INC
table lock mode where the lock lasts only to the end of the current SQL statement, not to the end of the entire transaction. Other clients cannot insert into the table while theAUTO-INC
table lock is held.You can refer this blog post as well: http://www.mysqlperformanceblog.com/2012/07/31/innodb-table-locks/