Wait for daemon ends

Resolves: #1072958

Conflicts:
	mariadb-scl-env-check.patch
	mariadb.spec
This commit is contained in:
Honza Horak 2015-02-18 16:50:54 +01:00
parent 5fdb6bd2c7
commit eb4231cae1
4 changed files with 48 additions and 3 deletions

View File

@ -1,7 +1,7 @@
diff -up mariadb-10.0.16/scripts/CMakeLists.txt.systemd mariadb-10.0.16/scripts/CMakeLists.txt
--- mariadb-10.0.16/scripts/CMakeLists.txt.systemd 2015-01-25 16:21:37.000000000 +0100
+++ mariadb-10.0.16/scripts/CMakeLists.txt 2015-02-03 10:53:05.261790495 +0100
@@ -367,6 +367,32 @@ ELSE()
@@ -367,6 +367,33 @@ ELSE()
COMPONENT ${${file}_COMPONENT}
)
ENDFOREACH()
@ -12,6 +12,7 @@ diff -up mariadb-10.0.16/scripts/CMakeLists.txt.systemd mariadb-10.0.16/scripts/
+ mysql.service
+ mysql-prepare-db-dir
+ mysql-wait-ready
+ mysql-wait-stop
+ mysql-check-socket
+ mysql-check-upgrade
+ mysql-scripts-common

View File

@ -112,7 +112,7 @@
Name: mariadb
Version: %{compatver}.%{bugfixver}
Release: 1%{?with_debug:.debug}%{?dist}
Release: 2%{?with_debug:.debug}%{?dist}
Epoch: 1
Summary: A community developed branch of MySQL
@ -137,6 +137,7 @@ Source13: mysql-wait-ready.sh
Source14: mysql-check-socket.sh
Source15: mysql-scripts-common.sh
Source16: mysql-check-upgrade.sh
Source17: mysql-wait-stop.sh
Source19: mysql.init.in
Source50: rh-skipped-tests-base.list
Source51: rh-skipped-tests-arm.list
@ -521,7 +522,7 @@ cat %{SOURCE52} | tee -a mysql-test/rh-skipped-tests.list
%endif
cp %{SOURCE2} %{SOURCE3} %{SOURCE10} %{SOURCE11} %{SOURCE12} %{SOURCE13} \
%{SOURCE14} %{SOURCE15} %{SOURCE16} %{SOURCE19} \
%{SOURCE14} %{SOURCE15} %{SOURCE16} %{SOURCE17} %{SOURCE19} \
scripts
%build
@ -686,6 +687,7 @@ install -D -p -m 755 scripts/mysql.init %{buildroot}%{daemondir}/%{daemon_name}
# helper scripts for service starting
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-wait-stop %{buildroot}%{_libexecdir}/mysql-wait-stop
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
@ -1072,6 +1074,7 @@ fi
%{daemondir}/%{daemon_name}*
%{_libexecdir}/mysql-prepare-db-dir
%{_libexecdir}/mysql-wait-ready
%{_libexecdir}/mysql-wait-stop
%{_libexecdir}/mysql-check-socket
%{_libexecdir}/mysql-check-upgrade
%{_libexecdir}/mysql-scripts-common
@ -1132,6 +1135,10 @@ fi
%endif
%changelog
* Fri Mar 06 2015 Honza Horak <hhorak@redhat.com> - 1:10.0.17-2
- Wait for daemon ends
Resolves: #1072958
* Wed Mar 04 2015 Honza Horak <hhorak@redhat.com> - 1:10.0.17-1
- Rebase to version 10.0.17
- Added variable for turn off skipping some tests

36
mysql-wait-stop.sh Normal file
View File

@ -0,0 +1,36 @@
#!/bin/sh
source "`dirname ${BASH_SOURCE[0]}`/mysql-scripts-common"
# This script waits for mysqld to be properly stopped
# (which can be many seconds in some large load).
# Running this as ExecStopPost is useful so that starting which is done
# as part of restart doesn't see the former process still running.
# Wait for the server to properly end the main server
ret=0
TIMEOUT=60
SECONDS=0
if ! [ -f "$pidfile" ]; then
exit 0
fi
MYSQLPID=`cat "$pidfile" 2>/dev/null`
if [ -z "$MYSQLPID" ] ; then
exit 2
fi
while /bin/true; do
# Check process still exists
if ! [ -d "/proc/${MYSQLPID}" ] ; then
break
fi
if [ $SECONDS -gt $TIMEOUT ] ; then
ret=3
break
fi
sleep 1
done
exit $ret

View File

@ -39,6 +39,7 @@ ExecStartPre=@libexecdir@/mysql-prepare-db-dir %n
ExecStart=@bindir@/mysqld_safe --basedir=@prefix@
ExecStartPost=@libexecdir@/mysql-wait-ready $MAINPID
ExecStartPost=@libexecdir@/mysql-check-upgrade
ExecStopPost=@libexecdir@/mysql-wait-stop
# Give a reasonable amount of time for the server to start up/shut down
TimeoutSec=300