Skip to content

Commit b80cc31

Browse files
committed
MDEV-9082 - Debian: mysql_install_db is called on upgrade
A comment in debian/mariadb-server-10.1.postinst says: "can safely run on upgrades with existing databases". While this is true there're a few reasons not to do that: - it increases installation time (it has to run rather heavy mysqld multiple times) - as well as it increases mysqld downtime - it may fail if database has some plugin specific configs (see MDEV-8437) - there should be no need to run this script on upgrade: they should be handled by mysql_upgrade to - RPM postin doesn't call it if database directory exists Also postinst is not supposed to create database directories: let mysql_install_db do that intead.
1 parent 7f5e005 commit b80cc31

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

debian/mariadb-server-10.1.postinst

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,10 @@ EOF
104104

105105
# Ensure the existence and right permissions for the database and
106106
# log files.
107-
if [ ! -d "$mysql_statedir" -a ! -L "$mysql_statedir" ]; then mkdir "$mysql_statedir"; fi
108-
if [ ! -d "$mysql_statedir/mysql" -a ! -L "$mysql_statedir/mysql" ]; then mkdir "$mysql_statedir/mysql"; fi
107+
if [ ! -d "$mysql_statedir/mysql" -a ! -L "$mysql_statedir/mysql" ]; then
108+
# Debian: beware of the bashisms...
109+
/bin/bash /usr/bin/mysql_install_db --rpm --user=mysql --disable-log-bin 2>&1 | $ERR_LOGGER
110+
fi
109111
if [ ! -d "$mysql_newlogdir" -a ! -L "$mysql_newlogdir" ]; then mkdir "$mysql_newlogdir"; fi
110112
# When creating an ext3 jounal on an already mounted filesystem like e.g.
111113
# /var/lib/mysql, you get a .journal file that is not modifyable by chown.
@@ -130,16 +132,6 @@ EOF
130132

131133
# To avoid downgrades.
132134
touch $mysql_statedir/debian-10.1.flag
133-
134-
# initiate databases. Output is not allowed by debconf :-(
135-
# This will fail if we are upgrading an existing database; in this case
136-
# mysql_upgrade, called from the /etc/init.d/mysql start script, will
137-
# handle things.
138-
# Debian: beware of the bashisms...
139-
# Debian: can safely run on upgrades with existing databases
140-
set +e
141-
/bin/bash /usr/bin/mysql_install_db --rpm --user=mysql --disable-log-bin 2>&1 | $ERR_LOGGER
142-
set -e
143135

144136
## On every reconfiguration the maintenance user is recreated.
145137
#

0 commit comments

Comments
 (0)