Magento 1.9.2.1 – Resolving Percona 5.7 Metadata Lock Issues

databasemagento-1.9performance

I'm working on a Magento 1.9.2.1 shop where we have some stability issue. From time to time, the Percona 5.7 database hits the "too many connections" limit and the shop becomes unresponsive. SHOW processlist seems to reveal that the issue is caused by a lot of query stuck Waiting for table metadata lock on this query: SELECT cataloginventory_stock_status.product_id, cataloginventory_stock_status.stock_status.

The server has active visitors, but it's by no mean under heavy load.

max_connection is set to 1024 (verified via show variables like '%connections%';)

This is the full output of processlist

Any hint is welcome, thanks.

Best Answer

To avoid lock, you should use READ COMMITTED transaction isolation level.

It's seems that you are importing stocks and reindexing data in the same time, you can also change scheduling.

I can tell you that with this request :

ALTER TABLE `cataloginventory_stock_status` DISABLE KEYS

You can check this Github issue for answer

Related Topic