When backing up a second database in addition to the site default database in cron, the both databases are backed up, but the last run time is never set on the second database. So the second database backup runs on every cron run.

For example: we run cron every two hours, but want one backup a day on both databases, and want to keep a week's worth of files on the server. The second database backup runs every cron run and fills the scheduled backups destination directory with its files, deleting the default database backup files.

The backup_to_file method on the backup_migrate_destination_db calls switch_db() twice to switch to the alternative database, and this messes up database stack in switch_db. As a result, when the system tries to update the last runtime, the wrong database is active and the update fails.

The fix is to delete second switch_db() call. I've attached a patch.

Note that you can direct both backups to the same destination and still limit the number of backup files to keep. Simply double the number of files to keep in the destination directory (e.g., if you're backing up two databases once a day and want to keep seven backups of each database in the destination, set both schedules to save 14 files).

This might relate to the issue at http://drupal.org/node/730160; I'll refer that issue here.

CommentFileSizeAuthor
destinations.db_.inc_.patch444 bytesjshuster@drupal.org

Comments

Mike Dodd’s picture

dgorton’s picture

Status: Active » Fixed

Closing - as both possible duplicates http://drupal.org/node/840272 and http://drupal.org/node/840272 are fixed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.