Check upgrade script added to warn about need for mysql_upgrade
This commit is contained in:
parent
c9f01efce7
commit
0d2208e0ac
@ -1,7 +1,7 @@
|
||||
diff -rup mysql-5.6.19-orig/scripts/CMakeLists.txt mysql-5.6.19/scripts/CMakeLists.txt
|
||||
--- mysql-5.6.19-orig/scripts/CMakeLists.txt 2014-07-22 10:07:12.053410263 +0200
|
||||
+++ mysql-5.6.19/scripts/CMakeLists.txt 2014-07-22 10:10:44.102502369 +0200
|
||||
@@ -381,6 +381,31 @@ ELSE()
|
||||
@@ -381,6 +381,32 @@ ELSE()
|
||||
ENDIF()
|
||||
INSTALL_SCRIPT(${CMAKE_CURRENT_BINARY_DIR}/${file} COMPONENT ${${file}_COMPONENT})
|
||||
ENDFOREACH()
|
||||
@ -13,6 +13,7 @@ diff -rup mysql-5.6.19-orig/scripts/CMakeLists.txt mysql-5.6.19/scripts/CMakeLis
|
||||
+ mysql-prepare-db-dir
|
||||
+ mysql-wait-ready
|
||||
+ mysql-check-socket
|
||||
+ mysql-check-upgrade
|
||||
+ mysql-scripts-common
|
||||
+ mysql_config_multilib
|
||||
+ mysql.init
|
||||
|
@ -59,7 +59,7 @@
|
||||
|
||||
Name: %{pkgname}
|
||||
Version: 5.6.21
|
||||
Release: 2%{?dist}
|
||||
Release: 3%{?dist}
|
||||
Summary: MySQL client programs and shared libraries
|
||||
Group: Applications/Databases
|
||||
URL: http://www.mysql.com
|
||||
@ -80,7 +80,8 @@ Source12: mysql-prepare-db-dir.sh
|
||||
Source13: mysql-wait-ready.sh
|
||||
Source14: mysql-check-socket.sh
|
||||
Source15: mysql-scripts-common.sh
|
||||
Source18: mysql.init.in
|
||||
Source16: mysql-check-upgrade.sh
|
||||
Source19: mysql.init.in
|
||||
# To track rpmlint warnings
|
||||
Source30: mysql-5.6.10-rpmlintrc
|
||||
|
||||
@ -403,7 +404,7 @@ add_test 'main.upgrade : unknown'
|
||||
popd
|
||||
|
||||
cp %{SOURCE2} %{SOURCE3} %{SOURCE10} %{SOURCE11} %{SOURCE12} %{SOURCE13} \
|
||||
%{SOURCE14} %{SOURCE15} %{SOURCE18} scripts
|
||||
%{SOURCE14} %{SOURCE15} %{SOURCE16} %{SOURCE19} scripts
|
||||
|
||||
%build
|
||||
# fail quickly and obviously if user tries to build as root
|
||||
@ -519,6 +520,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
|
||||
|
||||
# mysql-test includes one executable that doesn't belong under /usr/share,
|
||||
@ -852,6 +854,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}
|
||||
@ -897,6 +900,9 @@ fi
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Mon Sep 29 2014 Honza Horak <hhorak@redhat.com> - 5.6.21-3
|
||||
- Check upgrade script added to warn about need for mysql_upgrade
|
||||
|
||||
* Thu Sep 25 2014 Bjorn Munch <bjorn.munch@oracle.com> - 5.6.21-2
|
||||
- Using %%cmake macro break some tests, reverted
|
||||
- Unwanted dtrace dep fixed upstream
|
||||
|
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:
|
||||
http://dev.mysql.com/doc/refman/5.6/en/mysql-upgrade.html
|
||||
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 "@VERSION@" >"$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