Skip to content

Commit 3a6e781

Browse files
committed
MDEV-9165: Run chown much faster on the datadir during install/update
1 parent 618edd4 commit 3a6e781

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

debian/mariadb-server-10.2.postinst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ EOF
119119
# circumstances as it contains scripts that are executed by root.
120120
set +e
121121
chown -R 0:0 $mysql_statedir
122-
chown -R mysql $mysql_datadir
122+
find $mysql_datadir ! -uid $(id -u mysql) -print0 | xargs -0 -r chown mysql
123123
chown -R mysql:adm $mysql_logdir
124124
chmod 2750 $mysql_logdir
125125
set -e
@@ -144,7 +144,7 @@ EOF
144144
bash /usr/bin/mysql_install_db --rpm --cross-bootstrap --user=mysql --disable-log-bin 2>&1 | $ERR_LOGGER
145145
set -e
146146

147-
147+
148148
## On every reconfiguration the maintenance user is recreated.
149149
#
150150
# - It is easier to regenerate the password every time but as people
@@ -163,7 +163,7 @@ EOF
163163
# the old query which always succeeds and then the new which may or may not.
164164

165165
# recreate the credentials file if not present or without mysql_upgrade stanza
166-
dc=$mysql_cfgdir/debian.cnf;
166+
dc=$mysql_cfgdir/debian.cnf;
167167
if [ -e "$dc" -a -n "`fgrep mysql_upgrade $dc 2>/dev/null`" ]; then
168168
pass="`sed -n 's/^[ ]*password *= *// p' $dc | head -n 1`"
169169
else

debian/mariadb-server-10.2.preinst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ fi
199199
# The "set +e" is necessary as e.g. a ".journal" of a ext3 partition is
200200
# not chgrp'able (#318435).
201201
set +e
202-
chown mysql:mysql $mysql_datadir
202+
find $mysql_datadir ! -uid $(id -u mysql) -print0 | xargs -0 -r chown mysql
203203
find $mysql_datadir -follow -not -group mysql -print0 2>/dev/null \
204204
| xargs -0 --no-run-if-empty chgrp mysql
205205
set -e

0 commit comments

Comments
 (0)