Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sorry for the title of the question, here's my problem: I've been trying to set up some scripts that import a lot of stuff hourly from an external source. They seemed to work fine, so I set up a cronjob to run them every hour. One day later I find six or seven instances of that script just hogging the MySQL server, making it unresponsive. I killed their processes, but MySQL was still not responding. I had to kill MySQL, reboot and then MySQL started working again (who knows on what) and being unresponsive (yes, I did remove the scripts from the cronjobs). I SHOW PROCESSLISTed and killed every process I could find. Still nothing, MySQL is hogging the HDD and is at the top of top and making the server load go up in the sky. I don't know what to do, if I kill and start it again it will probably do the same thing. What should I do?

share|improve this question
    
What table types are you using? –  mbac32768 Apr 2 '10 at 12:18
    
MyISAM and InnoDB –  Felix Apr 2 '10 at 12:46
    
Please post the cron entry and the essence of the script. –  wallyk Apr 2 '10 at 15:52
    
@wallyk I was running the MB_MySQL project (MusicBrainz Database for MySQL -- google it) and had update.pl in the cron (set to run every hour at :30 minutes). –  Felix Apr 2 '10 at 18:54

1 Answer 1

up vote 4 down vote accepted

You DB is doing exactly what it is supposed to do. When a transaction gets killed, it needs to be rolled back. You can not stop it if you want a consistent database.

If this is not important for you, kill MySQL and create a whole new DB from scratch beacuse this one will never work again unless you let the rollback finish.

A suggestion for the cron jobs, make the first thing you do in the job is to check if you are still running from the previous time, and if so, exit. Make sure you have it logging what is happening so you can adjust the time between runs to a better value.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.