Fix MariaDB Backup Problems
This patch fixes 2 problems with MariaDB backup: 1) If a user with grants to a database has a hyphenated name, the backup script errors out and the grants for this user won't be saved in the backup. 2) While restoring databases from a backup, if connections are allowed during the restore operation, there is potential for deadlock. Table level locks are added to the backup sql file in order to try to prevent these deadlock situations. Change-Id: If612e7b9f3f4d75fc67018eea17609f07a0c0b0f
This commit is contained in:
parent
51bff9687e
commit
41342cdc4a
@ -61,6 +61,7 @@ for db in "${DBNAME[@]}"
|
||||
do
|
||||
echo $($MYSQL --skip-column-names -e "select concat('show grants for ',user,';') \
|
||||
from mysql.db where ucase(db)=ucase('$db');") | \
|
||||
sed -r "s/show grants for ([a-zA-Z0-9_-]*)/show grants for '\1'/" | \
|
||||
$MYSQL --silent --skip-column-names 2>grant_err.log > $BACKUPS_DIR/${db}_grant.sql
|
||||
if [ "$?" -eq 0 ]
|
||||
then
|
||||
|
@ -289,7 +289,7 @@ conf:
|
||||
base_path: /var/backup
|
||||
mysqldump_options: >
|
||||
--single-transaction --quick --add-drop-database
|
||||
--add-drop-table --databases
|
||||
--add-drop-table --add-locks --databases
|
||||
days_of_backup_to_keep: 3
|
||||
database:
|
||||
my: |
|
||||
|
Loading…
Reference in New Issue
Block a user