summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Black <daniel@mariadb.org>2022-01-25 13:59:41 +1100
committerDaniel Black <daniel@mariadb.org>2022-01-27 10:35:32 +1100
commit2e81eab29fed25655c57235c307c64383056bbe9 (patch)
tree6c98a012a67cfaf1ca66791d8883e92989ded992
parent2cbf92522b51390819ab5013ac9195382bd5d409 (diff)
downloadmariadb-git-2e81eab29fed25655c57235c307c64383056bbe9.tar.gz
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.
-rw-r--r--debian/mariadb-server-10.2.postinst2
-rw-r--r--man/mysql_install_db.115
-rw-r--r--scripts/mysql_install_db.sh7
3 files changed, 23 insertions, 1 deletions
diff --git a/debian/mariadb-server-10.2.postinst b/debian/mariadb-server-10.2.postinst
index 14b2053b3a0..3fe5a04fbc3 100644
--- a/debian/mariadb-server-10.2.postinst
+++ b/debian/mariadb-server-10.2.postinst
@@ -144,7 +144,7 @@ EOF
# Debian: beware of the bashisms...
# Debian: can safely run on upgrades with existing databases
set +e
- bash /usr/bin/mysql_install_db --rpm --cross-bootstrap --user=mysql --disable-log-bin 2>&1 | $ERR_LOGGER
+ bash /usr/bin/mysql_install_db --rpm --cross-bootstrap --user=mysql --disable-log-bin --upgrade-info 2>&1 | $ERR_LOGGER
set -e
## On every reconfiguration the maintenance user is recreated.
diff --git a/man/mysql_install_db.1 b/man/mysql_install_db.1
index 3406c9605b7..229a6f8df99 100644
--- a/man/mysql_install_db.1
+++ b/man/mysql_install_db.1
@@ -276,6 +276,21 @@ This must be given as the first argument\&.
.sp -1
.IP \(bu 2.3
.\}
+.\" mysql_install_db: upgrade-info option
+.\" upgrade-info option: mysql_install_db
+\fB\-\-upgrade\-info\fR
+.sp
+This places a mysql_upgrade_info file containing the server version in the data directory\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
.\" mysql_install_db: rpm option
.\" rpm option: mysql_install_db
\fB\-\-rpm\fR
diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh
index 6a415f4fa11..fdd3a42d77f 100644
--- a/scripts/mysql_install_db.sh
+++ b/scripts/mysql_install_db.sh
@@ -41,6 +41,7 @@ create database if not exists test;
use mysql;"
auth_root_authentication_method=normal
auth_root_socket_user='root'
+upgrade_info=0
dirname0=`dirname $0 2>/dev/null`
dirname0=`dirname $dirname0 2>/dev/null`
@@ -97,6 +98,7 @@ Usage: $0 [OPTIONS]
user. You must be root to use this option. By default
mysqld runs using your current login name and files and
directories that it creates will be owned by you.
+ --upgrade-info Store mysql_upgrade_info in the installed data directory.
All other options are passed to the mysqld program
@@ -152,6 +154,7 @@ parse_arguments()
--skip-name-resolve) ip_only=1 ;;
--verbose) verbose=1 ; silent_startup="" ;;
--rpm) in_rpm=1 ;;
+ --upgrade-info) upgrade_info=1 ;;
--help) usage ;;
--no-defaults|--defaults-file=*|--defaults-extra-file=*)
defaults="$arg" ;;
@@ -509,6 +512,10 @@ SET @auth_root_socket='$auth_root_socket_user';" ;;
esac
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
then
+ if test "$upgrade_info" -eq 1
+ then
+ printf "@VERSION@-MariaDB" > "$ldata/mysql_upgrade_info"
+ fi
s_echo "OK"
else
echo