Home > other >  Mediawiki database backups growing and shrinking randomly?
Mediawiki database backups growing and shrinking randomly?

Time:04-02

I have a backup script that uses mysqldump to dump a Mediawiki database, then archives it with gzip. It seems to be working okay, but I am curious why the size of the archives appear to grow and shrink at random. It's not a very active site, so large amounts of data aren't being added or deleted on the daily.

-rw-r--r-- 1 root root  91M Mar 27 11:46 wiki_data_20220325.sql.gz
-rw-r--r-- 1 root root  93M Mar 27 11:46 wiki_data_20220326.sql.gz
-rw-r--r-- 1 root root  92M Mar 27 11:56 wiki_data_20220327.sql.gz
-rw-r--r-- 1 root root 110M Mar 28 03:15 wiki_data_20220328.sql.gz
-rw-r--r-- 1 root root  99M Mar 29 03:15 wiki_data_20220329.sql.gz
-rw-r--r-- 1 root root 103M Mar 30 03:15 wiki_data_20220330.sql.gz
-rw-r--r-- 1 root root 107M Mar 31 03:15 wiki_data_20220331.sql.gz
-rw-r--r-- 1 root root  78M Mar 27 11:47 wiki_html_20220320.tar.gz
-rw-r--r-- 1 root root 173M Mar 27 11:47 wiki_xml_20220321.xml
-rw-r--r-- 1 root root 173M Mar 27 11:47 wiki_xml_20220322.xml
-rw-r--r-- 1 root root 173M Mar 27 11:47 wiki_xml_20220323.xml
-rw-r--r-- 1 root root 173M Mar 27 11:47 wiki_xml_20220324.xml

The size difference persists after extracting the archives.

-rw-rw-r--  1 user user 280M Mar 31 10:27 wiki0328.sql
-rw-r--r--  1 user user 110M Mar 31 10:26 wiki0328.sql.gz
-rw-rw-r--  1 user user 267M Mar 31 10:27 wiki0329.sql
-rw-r--r--  1 user user  99M Mar 31 10:26 wiki0329.sql.gz

It's not necessarily a problem, but I am curious. Is this common / normal behavior for databases dumped from complex software like Mediawiki?

Here's the relevant chunk of the backup script, in case it matters...

echo "## Set ReadOnly on"
echo "\$wgReadOnly = 'Dumping Database, Access will be restored shortly';" >> $localSet

echo "## Dumping XML..." 
php $dumpXML --full --quiet > $saveLoc/"wiki_xml_"$(date  %Y%m%d)".xml"

echo "## Dumping database..."
mysqldump my_wiki | gzip -f > $saveLoc/"wiki_data_"$(date  %Y%m%d)".sql.gz"

echo "## Set ReadOnly off"
tail -n 1 "$localSet" | wc -c | xargs -I {} truncate "$localSet" -s -{}

Thanks in advance for any info!

CodePudding user response:

Summary of the comments above: the objectcache table in a Wordpress database varies in size, and this is normal. Therefore it will cause the database backup to vary in size. To minimize the size of the backup, some people omit the objectcache table from backups.

  • Related