Check upgrade script added to warn about need for mysql_upgrade
This commit is contained in:
parent
77858d0995
commit
487b6d1b34
@ -1,7 +1,7 @@
|
||||
diff -up mariadb-10.0.12/scripts/CMakeLists.txt.systemd mariadb-10.0.12/scripts/CMakeLists.txt
|
||||
--- mariadb-10.0.12/scripts/CMakeLists.txt.systemd 2014-07-21 10:49:58.491470586 +0200
|
||||
+++ mariadb-10.0.12/scripts/CMakeLists.txt 2014-07-21 14:21:22.673329708 +0200
|
||||
@@ -368,6 +368,33 @@ ELSE()
|
||||
@@ -368,6 +368,34 @@ ELSE()
|
||||
COMPONENT ${${file}_COMPONENT}
|
||||
)
|
||||
ENDFOREACH()
|
||||
@ -13,6 +13,7 @@ diff -up mariadb-10.0.12/scripts/CMakeLists.txt.systemd mariadb-10.0.12/scripts/
|
||||
+ mysql-prepare-db-dir
|
||||
+ mysql-wait-ready
|
||||
+ mysql-check-socket
|
||||
+ mysql-check-upgrade
|
||||
+ mysql-scripts-common
|
||||
+ mysql_config_multilib
|
||||
+ mysql.init
|
||||
|
13
mariadb.spec
13
mariadb.spec
@ -125,9 +125,10 @@ Source12: mysql-prepare-db-dir.sh
|
||||
Source13: mysql-wait-ready.sh
|
||||
Source14: mysql-check-socket.sh
|
||||
Source15: mysql-scripts-common.sh
|
||||
Source16: mysql-compat.service.in
|
||||
Source17: mysql-compat.conf.in
|
||||
Source18: mysql.init.in
|
||||
Source16: mysql-check-upgrade.sh
|
||||
Source17: mysql-compat.service.in
|
||||
Source18: mysql-compat.conf.in
|
||||
Source19: mysql.init.in
|
||||
Source50: rh-skipped-tests-base.list
|
||||
Source51: rh-skipped-tests-intel.list
|
||||
Source52: rh-skipped-tests-arm.list
|
||||
@ -498,7 +499,8 @@ cat %{SOURCE54} >> mysql-test/rh-skipped-tests.list
|
||||
%endif
|
||||
|
||||
cp %{SOURCE2} %{SOURCE3} %{SOURCE10} %{SOURCE11} %{SOURCE12} %{SOURCE13} \
|
||||
%{SOURCE14} %{SOURCE15} %{SOURCE16} %{SOURCE17} %{SOURCE18} scripts
|
||||
%{SOURCE14} %{SOURCE15} %{SOURCE16} %{SOURCE17} %{SOURCE18} %{SOURCE19} \
|
||||
scripts
|
||||
|
||||
%build
|
||||
|
||||
@ -677,6 +679,7 @@ install -D -p -m 755 scripts/mysql.init %{buildroot}%{_initddir}/%{daemon_name}
|
||||
install -p -m 755 scripts/mysql-prepare-db-dir %{buildroot}%{_libexecdir}/mysql-prepare-db-dir
|
||||
install -p -m 755 scripts/mysql-wait-ready %{buildroot}%{_libexecdir}/mysql-wait-ready
|
||||
install -p -m 755 scripts/mysql-check-socket %{buildroot}%{_libexecdir}/mysql-check-socket
|
||||
install -p -m 755 scripts/mysql-check-upgrade %{buildroot}%{_libexecdir}/mysql-check-upgrade
|
||||
install -p -m 644 scripts/mysql-scripts-common %{buildroot}%{_libexecdir}/mysql-scripts-common
|
||||
|
||||
# Remove libmysqld.a
|
||||
@ -1089,6 +1092,7 @@ fi
|
||||
%{_libexecdir}/mysql-prepare-db-dir
|
||||
%{_libexecdir}/mysql-wait-ready
|
||||
%{_libexecdir}/mysql-check-socket
|
||||
%{_libexecdir}/mysql-check-upgrade
|
||||
%{_libexecdir}/mysql-scripts-common
|
||||
|
||||
%{?with_init_systemd:%{_tmpfilesdir}/%{name}.conf}
|
||||
@ -1158,6 +1162,7 @@ fi
|
||||
client.cnf into -libs, mysql_plugin and msql2mysql into base,
|
||||
tokuftdump and aria_* into -server, errmsg-utf8.txt into -errmsg
|
||||
- Remove duplicate cnf files packaged using %%doc
|
||||
- Check upgrade script added to warn about need for mysql_upgrade
|
||||
|
||||
* Wed Sep 24 2014 Matej Muzila <mmuzila@redhat.com> - 1:10.0.13-7
|
||||
- Client related libraries moved from mariadb-server to mariadb-libs
|
||||
|
39
mysql-check-upgrade.sh
Normal file
39
mysql-check-upgrade.sh
Normal file
@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
|
||||
source "`dirname ${BASH_SOURCE[0]}`/mysql-scripts-common"
|
||||
|
||||
upgrade_info_file="$datadir/mysql_upgrade_info"
|
||||
version=0
|
||||
# get version as integer from mysql_upgrade_info file
|
||||
if [ -f "$upgrade_info_file" ] && [ -r "$upgrade_info_file" ] ; then
|
||||
version_major=$(cat "$upgrade_info_file" | head -n 1 | sed -e 's/\([0-9]*\)\.\([0-9]*\)\..*$/\1/')
|
||||
version_minor=$(cat "$upgrade_info_file" | head -n 1 | sed -e 's/\([0-9]*\)\.\([0-9]*\)\..*$/\2/')
|
||||
if [[ $version_major =~ ^[0-9]+$ ]] && [[ $version_minor =~ ^[0-9]+$ ]] ; then
|
||||
version=$((version_major*100+version_minor))
|
||||
fi
|
||||
fi
|
||||
|
||||
# compute current version as integer
|
||||
thisversion=$((@MAJOR_VERSION@*100+@MINOR_VERSION@))
|
||||
|
||||
# provide warning in cases we should run mysql_upgrade
|
||||
if [ $version -ne $thisversion ] ; then
|
||||
|
||||
# give extra warning if some version seems to be skipped
|
||||
if [ $version -gt 0 ] && [ $version -lt 505 ] ; then
|
||||
echo "The datadir located at $datadir seems to be older than of a version 5.5. Please, mind that as a general rule, to upgrade from one release series to another, go to the next series rather than skipping a series." >&2
|
||||
fi
|
||||
|
||||
cat <<EOF >&2
|
||||
The datadir located at $datadir needs to be upgraded using 'mysql_upgrade' tool. This can be done using the following steps:
|
||||
|
||||
1. Back-up your data before running 'mysql_upgrade'
|
||||
2. Start the database daemon using 'systemctl start @DAEMON_NAME@.service'
|
||||
3. Run 'mysql_upgrade' with a database user that has sufficent privileges
|
||||
|
||||
Read more about 'mysql_upgrade' usage at:
|
||||
https://mariadb.com/kb/en/mariadb/documentation/sql-commands/table-commands/mysql_upgrade/
|
||||
EOF
|
||||
fi
|
||||
|
||||
exit 0
|
@ -80,6 +80,8 @@ if [ ! -d "$datadir/mysql" ] ; then
|
||||
fi
|
||||
exit $ret
|
||||
fi
|
||||
# upgrade does not need to be run on a fresh datadir
|
||||
echo "@MYSQL_VERSION_ID@" >"$datadir/mysql_upgrade_info"
|
||||
# In case we're running as root, make sure files are owned properly
|
||||
chown -R "$myuser:$mygroup" "$datadir"
|
||||
fi
|
||||
|
@ -38,6 +38,7 @@ ExecStartPre=@libexecdir@/mysql-prepare-db-dir %n
|
||||
# per bug #547485
|
||||
ExecStart=@bindir@/mysqld_safe --basedir=@prefix@
|
||||
ExecStartPost=@libexecdir@/mysql-wait-ready $MAINPID
|
||||
ExecStartPost=@libexecdir@/mysql-check-upgrade
|
||||
|
||||
# Give a reasonable amount of time for the server to start up/shut down
|
||||
TimeoutSec=300
|
||||
|
Loading…
Reference in New Issue
Block a user