Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

MySQL metadata lock blocking problem

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Saturday, April 1, 2017

After adding two fields to the main database of a business, the business side reported that the new field could not be seen from the library after 30 minutes.

Execute show slave status on slave\ G as shown below

Show porcesslist; is shown in the following figure:

In figure 2 above, you can see that there is a large delay, and the alter operation on the slave library has been waiting for metadata lock and is in a blocking state.

Solution:

Use SELECT * FROM information_schema.innodb_trx\ G to find the problem caused by the transaction that was not committed:

Kill2359; can just kill the thread.

After killing this thread, the show slave status\ G master-slave delay immediately dropped, and the show processlist was no longer in a locked state. [show slave status\ G even if it is a lock, that is, a short time system lock]

If we use zabbix's percona monitoring, we can adjust the threshold of the relevant triggers, as shown below:

The default is 100 on the template. Usually only alter table or select.. Operations such as for update will cause LOCK, so if the lock thread exceeds 50 in normal business, you need to pay attention to the situation.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report