Ticket #219 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

wp-db-backup can't handle large databases [patch]

Reported by: ringmaster Assigned to: skippy
Priority: normal Component: wp-db-backup
Severity: normal Keywords: backup gzip large database
Cc:

Description

Depending on the size of the database, wp-db-backup can't hold all of the information in the database inside a single string. In this case, it runs out of memory, reporting an unfriendly error and not backing up anything.

The attached patch switches the SQL output to write directly to the backup file, rather than first aggregating the SQL statements into a string and then writing to the file.

I could not determine a way to gzip a file without first loading it into memory, so the patch detects whether the raw backup script is too large to contain in memory and if so, it reports a friendlier error with advice to turn off gzip handling.

An improvement beyond this patch would allow the system to gzip directly from disk regardless of the backup file size, or perhaps break the backup into pieces and tar them, or perhaps use gzip output buffering to transfer the raw data, which could then be archived on the downloading client.

Also added in this patch are a few label tags that were missing and driving me nuts.

Attachments

wp-db-backup.diff (11.9 kB) - added by ringmaster on 07/14/05 19:57:27.

Change History

07/14/05 19:57:27 changed by ringmaster

  • attachment wp-db-backup.diff added.

07/19/05 12:42:53 changed by skippy

  • status changed from new to closed.
  • resolution set to fixed.

Patch applied. Backups work as expected. The backup process is noticably slower, but not dreadfully slow. The fact that this will allow other folks to backup at all makes this patch worthwhile. Thanks, ringmaster.