MySQL 5.1 mysqlhotcopy and log tables: check your backup scripts!

Using MySQL 5.1 you can log to tables when --log-output=TABLE is set. Both tables, mysql.general_log and mysql.slow_log, are created using the CSV engine. Problem here is that when you use mysqlhotcopy to backup the mysql database, you will get an error message saying the tables can’t be locked.

shell> mysqlhotcopy mysqlDBD::mysql::db do failed: You can't use locks with log tables. at /usr/bin/mysqlhotcopy line 452.

Solution or workaround, use a regular expression to ignore all tables which end with the string ‘_log’:

shell> mysqlhotcopy mysql./~.+_log$/

But that’s not the end of it. We found this to be actually a bug, but not a biggy really. I opend a bug report and also proposed a fix. Basically, we would ignore certain tables which mysqldump is also ignoring.

I actually did Perl today! OH MY!!1

Comments

datacharmer
Using Perl is not that evil!
Congratulations :)

Giuseppe