cassidius
cassidius

Reputation: 118

Update query is locked

This is probably a loaded question, but what could be the cause of our MySQL process locks? We ran into an issue where we were trying to use a feature of our software and it 'froze'. Looking into the issue, we found that a query to the MySQL database was 'locked' and the software was waiting for the lock to unlock/resolve before returning.

Some background, we're running a Spring application on Glassfish and letting GF do the DB connection pools management. Everything seemed to be working fine until we started getting these threads locking up when we made requests to perform one particular 'update' function.

The only thing I've been able to find is the first answer here - MySQL InnoDB hangs on waiting for table-level locks. We may have run a dump of the database while people were using the system. Is that the most likely cause or could there be other things at work here?

Upvotes: 0

Views: 947

Answers (1)

Marcus Adams
Marcus Adams

Reputation: 53830

Certainly, mysqldump, with the default options, will lock the tables before dumping them, causing updates to completely block with InnoDB.

Use the --single-transaction option with mysqldump to avoid the issue.

See: Run MySQLDump without Locking Tables

Further, since it's a table lock, not a row lock, the timeout cannot be controlled with innodb_lock_wait_timeout.

Upvotes: 1

Related Questions