From a3b1696cfca6c3b8fa63f7aaeb7d52d3a68348b6 Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Wed, 5 Feb 2020 16:17:52 +1300 Subject: [PATCH] Fix backup instructions when large logs are recorded If the database contains task logs that are over the default max packet size for MariaDB, then attempting to dump the database will fail, but it won't be immediately obvious that that has happened - the gzipped sql file will simply be truncated and have an error in it. To fix the underlying issue, add an option to the example command for database backup to increase the max packet size to 512MB. (Restoring the database doesn't seem to suffer the same issue). In future we should probably look at writing a script to do this and in it properly check the return of mysqldump so that any problems get noticed immediately. Signed-off-by: Paul Eggleton --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index be6cda7..6df1bf0 100644 --- a/README +++ b/README @@ -412,7 +412,7 @@ To back up the database within the docker-based setup, you can run the following command (no need to substitute ${MYSQL_ROOT_PASSWORD}, it's already present within the container environment): -docker-compose exec layersdb /bin/sh -c '/usr/bin/mysqldump -u root --password=${MYSQL_ROOT_PASSWORD} layersdb' | gzip > backup-`date +%Y_%m_%d_%H%M`.sql.gz +docker-compose exec layersdb /bin/sh -c '/usr/bin/mysqldump -u root --password=${MYSQL_ROOT_PASSWORD} --max_allowed_packet=512M layersdb' | gzip > backup-`date +%Y_%m_%d_%H%M`.sql.gz To restore one of these backups you would run the following command (take care, this will overwrite the data immediately without prompting!):