Perform a full dump before upgrading MariaDB

This commit is contained in:
VirtuBox
2020-10-22 20:39:25 +02:00
parent e2bfcd326e
commit cbd29a968c
7 changed files with 52 additions and 25 deletions

View File

@@ -26,7 +26,7 @@ class WOStackMigrateController(CementBaseController):
@expose(hide=True)
def migrate_mariadb(self):
# Backup all database
WOMysql.backupAll(self)
WOMysql.backupAll(self, fulldump=True)
if not WOVar.wo_distro == 'raspbian':
if (not WOVar.wo_platform_codename == 'jessie'):

View File

@@ -964,7 +964,9 @@ def post_pref(self, apt_packages, packages, upgrade=False):
'/etc/mysql/conf.d/my.cnf')
except CommandExecutionError:
Log.error(self, "Unable to set MySQL password")
Log.info(self, "Tuning MariaDB configuration")
WOGit.add(self, ["/etc/mysql"],
msg="Adding MySQL into Git")
Log.wait(self, "Tuning MariaDB configuration")
if not os.path.isfile("/etc/mysql/my.cnf.default-pkg"):
WOFileUtils.copyfile(self, "/etc/mysql/my.cnf",
"/etc/mysql/my.cnf.default-pkg")
@@ -1013,15 +1015,16 @@ def post_pref(self, apt_packages, packages, upgrade=False):
'mariadb.service.d/limits.conf',
'[Service]\nLimitNOFILE=500000')
WOShellExec.cmd_exec(self, 'systemctl daemon-reload')
Log.valide(self, "Tuning MySQL configuration")
# set innodb_buffer_pool_instances depending
# on the amount of RAM
WOService.stop_service(self, 'mysql')
WOService.restart_service(self, 'mysql')
# WOFileUtils.mvfile(self, '/var/lib/mysql/ib_logfile0',
# '/var/lib/mysql/ib_logfile0.bak')
# WOFileUtils.mvfile(self, '/var/lib/mysql/ib_logfile1',
# '/var/lib/mysql/ib_logfile1.bak')
WOService.start_service(self, 'mysql')
WOCron.setcron_weekly(self, 'mysqlcheck -Aos --auto-repair '
'> /dev/null 2>&1',

View File

@@ -315,7 +315,7 @@ class WOStackUpgradeController(CementBaseController):
# mariadb upgrade
if ("mariadb-server" in apt_packages and
mariadbmajorupgrade is True):
WOMysql.backupAll(self)
WOMysql.backupAll(self, fulldump=True)
WOAptGet.remove(self, ["mariadb-server"])
# upgrade packages
WOAptGet.install(self, apt_packages)