WordPress.org

Plugin Directory

wp-db-backup

Opened 10 years ago

Closed 10 years ago

#219 closed defect (fixed)

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

Reported by: ringmaster Owned by: skippy
Priority: normal Severity: normal
Plugin: wp-db-backup 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 (1)

wp-db-backup.diff (11.9 KB) - added by ringmaster 10 years ago.

Download all attachments as: .zip

Change History (2)

@ringmaster10 years ago

comment:1 @skippy10 years ago

  • Resolution set to fixed
  • Status changed from new to closed

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.

Note: See TracTickets for help on using tickets.