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 <paul.eggleton@linux.intel.com>
This commit is contained in:
Paul Eggleton 2020-02-05 16:17:52 +13:00
parent 9cf0829f41
commit a3b1696cfc

2
README
View File

@ -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!):