MySQL regular log troubleshooting

Source: Internet
Author: User
For the official MySQL database. 5.5 and earlier versions of the lock information is not comprehensive, if you can switch to mariadb version; for viewing the lock information, you can use

For the official MySQL database. 5.5 and earlier versions of the lock information is not comprehensive, if you can switch to mariadb version; for viewing the lock information, you can use

MySQL version: 5.0.82

In the test environment, the developer told me that the lock wait timeout prompt is not displayed when the database cannot insert;

The first impression is that it is locked by a specific statement. Execute show full processlist multiple times to view the operations performed on the same table. Check that show engine innodb status \ G only displays the locked statements, the statement to lock is not displayed (this is also displayed in official version 5.5. The information displayed in the mariadb branch is more detailed !);

In this case, the innodb monitor is enabled, and innodb_lock_monitor is detected once every 16 s, and nothing is found during the test program. At this time, we can only start to suspect the OS problems, cpu load, and disk IO; because the network is isolated, the network is suspected at first, and the connection is often disconnected, and the change to the same network is still invalid. Then, all the data is mysqldump (this eliminates the problem that the disk is not damaged, at least)

In this case, we can only doubt the program problem. java uses the connection pool and initially suspected the reuse of a non-commit thread. The general log is opened this time. The display format is: time thread id SQL statement; this time we have a great harvest. By comparing the number of commit and set autocommit, corresponding to the specific thread, we can know which thread has not committed the transaction; at this time, the rest is for developers to modify the code.

Summary: For the MySQL official original database. The lock information in versions 5.5 and below is incomplete, and can be switched to mariadb. for viewing the lock information, you can use the new feature in 5.5: performance_schema, which is very convenient; general log should be well utilized. It is a treasure to diagnose faults and test performance !!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.