Skip to content

Commit 2e81eab

Browse files
committed
MDEV-27607: mysql_install_db to install mysql_upgrade_info
For compatibility this is under an extra option --upgrade-info The goal here is to install a data directory with the required info to let mysql_upgrade know that an upgrade isn't required.
1 parent 2cbf925 commit 2e81eab

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

debian/mariadb-server-10.2.postinst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ EOF
144144
# Debian: beware of the bashisms...
145145
# Debian: can safely run on upgrades with existing databases
146146
set +e
147-
bash /usr/bin/mysql_install_db --rpm --cross-bootstrap --user=mysql --disable-log-bin 2>&1 | $ERR_LOGGER
147+
bash /usr/bin/mysql_install_db --rpm --cross-bootstrap --user=mysql --disable-log-bin --upgrade-info 2>&1 | $ERR_LOGGER
148148
set -e
149149

150150
## On every reconfiguration the maintenance user is recreated.

man/mysql_install_db.1

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,21 @@ This must be given as the first argument\&.
276276
.sp -1
277277
.IP \(bu 2.3
278278
.\}
279+
.\" mysql_install_db: upgrade-info option
280+
.\" upgrade-info option: mysql_install_db
281+
\fB\-\-upgrade\-info\fR
282+
.sp
283+
This places a mysql_upgrade_info file containing the server version in the data directory\&.
284+
.RE
285+
.sp
286+
.RS 4
287+
.ie n \{\
288+
\h'-04'\(bu\h'+03'\c
289+
.\}
290+
.el \{\
291+
.sp -1
292+
.IP \(bu 2.3
293+
.\}
279294
.\" mysql_install_db: rpm option
280295
.\" rpm option: mysql_install_db
281296
\fB\-\-rpm\fR

scripts/mysql_install_db.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ create database if not exists test;
4141
use mysql;"
4242
auth_root_authentication_method=normal
4343
auth_root_socket_user='root'
44+
upgrade_info=0
4445

4546
dirname0=`dirname $0 2>/dev/null`
4647
dirname0=`dirname $dirname0 2>/dev/null`
@@ -97,6 +98,7 @@ Usage: $0 [OPTIONS]
9798
user. You must be root to use this option. By default
9899
mysqld runs using your current login name and files and
99100
directories that it creates will be owned by you.
101+
--upgrade-info Store mysql_upgrade_info in the installed data directory.
100102
101103
All other options are passed to the mysqld program
102104
@@ -152,6 +154,7 @@ parse_arguments()
152154
--skip-name-resolve) ip_only=1 ;;
153155
--verbose) verbose=1 ; silent_startup="" ;;
154156
--rpm) in_rpm=1 ;;
157+
--upgrade-info) upgrade_info=1 ;;
155158
--help) usage ;;
156159
--no-defaults|--defaults-file=*|--defaults-extra-file=*)
157160
defaults="$arg" ;;
@@ -509,6 +512,10 @@ SET @auth_root_socket='$auth_root_socket_user';" ;;
509512
esac
510513
if { echo "$install_params"; cat "$create_system_tables" "$create_system_tables2" "$fill_system_tables" "$fill_help_tables" "$maria_add_gis_sp"; } | eval "$filter_cmd_line" | mysqld_install_cmd_line > /dev/null
511514
then
515+
if test "$upgrade_info" -eq 1
516+
then
517+
printf "@VERSION@-MariaDB" > "$ldata/mysql_upgrade_info"
518+
fi
512519
s_echo "OK"
513520
else
514521
echo

0 commit comments

Comments
 (0)