Gitweb:
http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=44f44766b02...
Commit: 44f44766b02d5b16b9345d37d58d9184ab423889
Parent: ddb0cfbd344395f63dce31794bb7eea3f7be1ce8
Author: Ryan McCabe <rmccabe(a)redhat.com>
AuthorDate: Thu Mar 13 13:31:47 2014 -0400
Committer: Ryan McCabe <rmccabe(a)redhat.com>
CommitterDate: Thu Mar 13 13:31:47 2014 -0400
rgmanager: postgres-8.sh: Shutdown postgres with SIGINT before forcing SIGQUIT
Apply commit 2f19b4b9a2158e0c1ccf895fef88372d6e3213d8 from resource-agents git
tree.
SIGINT should be attempted shutdown the postgres server before
issuing a SIGQUIT to force the shutdown. The shutdown signals
are documented here.
http://www.postgresql.org/docs/8.4/static/server-shutdown.html
Patch by David Vossel <dvossel(a)redhat.com>
Adjusted to make it apply over this tree.
Resolves: rhbz#1035034
Signed-off-by: Ryan McCabe <rmccabe(a)redhat.com>
---
rgmanager/src/resources/postgres-8.metadata | 4 ++--
rgmanager/src/resources/postgres-8.sh | 5 +++--
rgmanager/src/resources/utils/ra-skelet.sh | 15 ++++++++++++---
3 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/rgmanager/src/resources/postgres-8.metadata
b/rgmanager/src/resources/postgres-8.metadata
index b061fc5..f8d91d8 100644
--- a/rgmanager/src/resources/postgres-8.metadata
+++ b/rgmanager/src/resources/postgres-8.metadata
@@ -87,8 +87,8 @@
</parameters>
<actions>
- <action name="start" timeout="0"/>
- <action name="stop" timeout="0"/>
+ <action name="start" timeout="30"/>
+ <action name="stop" timeout="30"/>
<!-- Checks to see if it''s mounted in the right place -->
<action name="status" interval="1m" timeout="10"/>
diff --git a/rgmanager/src/resources/postgres-8.sh
b/rgmanager/src/resources/postgres-8.sh
index 585da6a..e2ef011 100755
--- a/rgmanager/src/resources/postgres-8.sh
+++ b/rgmanager/src/resources/postgres-8.sh
@@ -37,6 +37,7 @@ declare PSQL_CTL="/usr/bin/pg_ctl"
declare PSQL_pid_file="`generate_name_for_pid_file`"
declare PSQL_conf_dir="`generate_name_for_conf_dir`"
declare PSQL_gen_config_file="$PSQL_conf_dir/postgresql.conf"
+declare PSQL_stop_timeout="15"
declare PSQL_kill_timeout="5"
verify_all()
@@ -190,8 +191,8 @@ stop()
{
clog_service_stop $CLOG_INIT
- ## Send -KILL signal immediately
- stop_generic_sigkill "$PSQL_pid_file" 0 "$PSQL_kill_timeout"
+ ## Send -INT to close connections and stop. -QUIT is used if -INT signal does not stop
process.
+ stop_generic_sigkill "$PSQL_pid_file" "$PSQL_stop_timeout"
"$PSQL_kill_timeout" "-INT"
if [ $? -ne 0 ]; then
clog_service_stop $CLOG_FAILED
return $OCF_ERR_GENERIC
diff --git a/rgmanager/src/resources/utils/ra-skelet.sh
b/rgmanager/src/resources/utils/ra-skelet.sh
index 171ecd1..f1c3d70 100644
--- a/rgmanager/src/resources/utils/ra-skelet.sh
+++ b/rgmanager/src/resources/utils/ra-skelet.sh
@@ -47,9 +47,14 @@ stop_generic()
{
declare pid_file="$1"
declare stop_timeout="$2"
+ declare stop_sig="$3"
declare pid;
declare count=0;
+ if [ -z "$stop_sig" ]; then
+ stop_sig="-TERM"
+ fi
+
if [ ! -e "$pid_file" ]; then
clog_check_file_exist $CLOG_FAILED_NOT_FOUND "$pid_file"
# In stop-after-stop situation there is no PID file but
@@ -74,7 +79,7 @@ stop_generic()
return 0;
fi
- kill -TERM "$pid"
+ kill $stop_sig "$pid"
if [ $? -ne 0 ]; then
return $OCF_ERR_GENERIC
@@ -100,12 +105,16 @@ stop_generic_sigkill() {
declare pid_file="$1"
declare stop_timeout="$2"
declare kill_timeout="$3"
+ declare stop_sig="$4"
declare pid
-
+
+ if [ -z "$stop_sig" ]; then
+ stop_sig="-TERM"
+ fi
## If stop_timeout is equal to zero then we do not want
## to give -TERM signal at all.
if [ $stop_timeout -ne 0 ]; then
- stop_generic "$pid_file" "$stop_timeout"
+ stop_generic "$pid_file" "$stop_timeout" "$stop_sig"
if [ $? -eq 0 ]; then
return 0;
fi