The MySQL server extension is designed for DBA::Backup and helps with the backup process.
Please note that this is currently a broken partial port from the original working MySQL specific module. The port will be completed soon and a functional version will be uploaded. For further inquiries, please reach out to either myself or the [email protected] mailing list, which you can subscribe to.
The mysql_flush_logs function utilizes mysqladmin refresh to flush all logs and tables. Meanwhile, the mysql_rotate_logs function rotates the binary update, error, and any extra mysql logs specified in the conf file. Rotation of binary and error logs is mandatory on runs when the databases get backed up. Error and binary logs are kept as incrementals, while other logs are just appended and cleared and restarted once they exceed a certain size (as defined in conf).
The _rotate_error_log() function aims to restore some sanity to how mysql treats the error log. As of mysql 4.0.10, every flush-logs command will cause the error log to rotate to a file with an "-old" suffix attached. This is regardless of the file's size, and mysql shutdown/startup will not rotate the error log to the -old file. Any previous -old file is deleted. The function calls for a new -old file, which will be appended to the end of our own file (different name) and delete the -old file. The usual _rotate_generic_log function is then called on it.
The _cycle_bin_logs() issues a command to mysqld to complete writing to the current binary update log and start writing to a new one. We then push all of the bin-logs (except for the newest one) into [dump_dir]/00/. The flush logs command causes mysqld to close the old (already renamed) general query and slow query logs and reopen the logs of the usual file name. It also flushes the binary update log and begins writing to a new binlog file. It does not affect the error log, and only a restart of mysqld will begin a new error log. Meanwhile, the flush hosts command is meant to clean up the hosts cache.
The _backup_databases() function backs up all databases on the server DBMS, which are mentioned explicitly or as a pattern in the [included-databases] section in the config file. This function will dump all specified databases to .sql.gz files in the directory [dump_dir]/new/. If there were no errors during backup, _rotate_dump_dirs will rename it [dump_dir]/00/. If this function encounters errors during backup, the partial dumps to [dump_dir]/new/ will remain until the next time this function is executed, upon which the contents of [dump_dir]/new/ will be destroyed and new dumps will be placed there. At no time are binary update logs ever placed in [dump_dir]/new/. The function returns with the number of errors encountered during backup.
Version 0.2_1: N/A