Virtual machine won't delete with error:
Mysql2::Error: Lock wait timeout exceeded; try restarting transaction xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
OnApp 3.x.x 4.x 5.x
This error occurs when the database either is too busy or has too many records in the table it is attempting to delete from. This often occurs on virtual machines that have been on the cloud for a long time, and also if there are other heavy database queries happening on the server at the same time.
There are a couple of different options to solve this one. It is recommended that you increase the lock wait timeout in the MySQL configuration, restart the MySQL server, and then attempt the delete again. You may repeat the delete also, but it can take a few more attempts and may also cause other errors to occur. If further errors do occur, contact technical support.
To increase the lock wait timeout:
- SSH into the control server as the root user
- Edit the file
Under the [mysqld] section, add or edit
Replacing #### with the amount of seconds you would like. The default is 50, and a good number to increase this to is 120 or higher, depending on the amount of disk statistics VM's have.
- Verify no transactions are running/pending and stop the OnApp daemon with
- Restart the MySQL server with
- Optionally, verify the MySQL settings by opening the mysql cli and running
- Start the OnApp daemon again with
Once this has been done, the delete query should finish properly and also prevent the problem from happening in the future.
This failure may delete the virtual machine's vdisk. If the error message "Error running lvchange: One or more specified logical volume(s) not found." appears in that following log failure, refer to this other article.