Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=fde6e0e3a1fc1…
Commit: fde6e0e3a1fc1dac3b95d7cd96315bb2231ccfd5
Parent: a2140f35bd8cd7b01cbf8c94f9fd7e12b6b59302
Author: Ryan McCabe <rmccabe(a)redhat.com>
AuthorDate: Thu Mar 13 14:24:50 2014 -0400
Committer: Ryan McCabe <rmccabe(a)redhat.com>
CommitterDate: Thu Mar 13 14:24:50 2014 -0400
rgmanager: Fix for clustat crash when using an invalid config
Fix for a crash in clustat when executed with an invalid cluster
configuration file.
Resolves: rhbz#853083
Signed-off-by: Ryan McCabe <rmccabe(a)redhat.com>
---
rgmanager/src/utils/clustat.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/rgmanager/src/utils/clustat.c b/rgmanager/src/utils/clustat.c
index e9fc4ef..d0ccbf8 100644
--- a/rgmanager/src/utils/clustat.c
+++ b/rgmanager/src/utils/clustat.c
@@ -980,6 +980,10 @@ build_member_list(cman_handle_t ch, int *lid)
/* See if our config has anyone missed. If so, flag
them as missing from the config file */
+ if (!all->cml_members) {
+ all->cml_count = 0;
+ fprintf(stderr, "Error: ccs returned no members. Output may be unreliable.\n");
+ }
all = add_missing(all, part);
/* Flag online nodes */
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=44f44766b02d5…
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
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=f5e510ffc9f76…
Commit: f5e510ffc9f762093d6d83b5d5876f50b892868a
Parent: 24d751325ef921e73dc28ba64a13d581a2ea442f
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Fri Apr 8 15:16:58 2011 +0200
Committer: Ryan McCabe <rmccabe(a)redhat.com>
CommitterDate: Thu Mar 13 13:21:04 2014 -0400
postgres-8: Improve testing if postgres started succesfully
In previous versions we were not testing if postgres started succesfully. If
starting failed then we will encounter problem in first attempt to test
availability. This new feature proposed by Magnus Glatz uses pg_ctl to check
this directly.
Resolves: rhbz#663827 (part 2/2)
Acked-by: Ryan McCabe <rmccabe(a)redhat.com>
---
rgmanager/src/resources/postgres-8.sh | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/rgmanager/src/resources/postgres-8.sh b/rgmanager/src/resources/postgres-8.sh
index 8762d36..f99e32d 100755
--- a/rgmanager/src/resources/postgres-8.sh
+++ b/rgmanager/src/resources/postgres-8.sh
@@ -33,10 +33,12 @@ export PATH=/bin:/sbin:/usr/bin:/usr/sbin
. $(dirname $0)/utils/ra-skelet.sh
declare PSQL_POSTMASTER="/usr/bin/postmaster"
+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_kill_timeout="5"
+declare PSQL_wait_after_start="2"
verify_all()
{
@@ -165,6 +167,11 @@ start()
su - "$OCF_RESKEY_postmaster_user" -c "$PSQL_POSTMASTER -c config_file=\"$PSQL_gen_config_file\" \
$OCF_RESKEY_postmaster_options" &> /dev/null &
+ # We need to sleep for a second to allow pg_ctl to detect that we've started.
+ sleep $PSQL_wait_after_start
+ # We need to fetch "-D /path/to/pgsql/data" from $OCF_RESKEY_postmaster_options
+ su - "$OCF_RESKEY_postmaster_user" -c "$PSQL_CTL status $OCF_RESKEY_postmaster_options" &> /dev/null
+
if [ $? -ne 0 ]; then
clog_service_start $CLOG_FAILED
return $OCF_ERR_GENERIC
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=24d751325ef92…
Commit: 24d751325ef921e73dc28ba64a13d581a2ea442f
Parent: 1c64c5311961697a66ba3ee745e7b1d847409c8c
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Fri Apr 8 15:03:41 2011 +0200
Committer: Ryan McCabe <rmccabe(a)redhat.com>
CommitterDate: Thu Mar 13 13:20:22 2014 -0400
postgres-8: Do not send -TERM signal when killing postgres
Sending SIGQUIT will ensure Postgres shutdowns immediately, preventing
a service failure in some scenarios. Leads to recovery of transactions
when started up again, for example on a new node - which makes sense.
Also works nice with live streaming replication setups between two databases.
Resolves: rhbz#663827 (part 1/2)
Acked-by: Ryan McCabe <rmccabe(a)redhat.com>
---
rgmanager/src/resources/postgres-8.metadata | 4 +++-
rgmanager/src/resources/postgres-8.sh | 3 ++-
rgmanager/src/resources/utils/ra-skelet.sh | 10 +++++++---
3 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/rgmanager/src/resources/postgres-8.metadata b/rgmanager/src/resources/postgres-8.metadata
index 760e865..67c863e 100644
--- a/rgmanager/src/resources/postgres-8.metadata
+++ b/rgmanager/src/resources/postgres-8.metadata
@@ -53,10 +53,12 @@
<parameter name="shutdown_wait">
<longdesc lang="en">
- Wait X seconds for correct end of service shutdown
+ Wait X seconds for correct end of service shutdown.
+ This option is ignored in current release.
</longdesc>
<shortdesc lang="en">
Wait X seconds for correct end of service shutdown
+ This option is ignored in current release.
</shortdesc>
<content type="number" />
</parameter>
diff --git a/rgmanager/src/resources/postgres-8.sh b/rgmanager/src/resources/postgres-8.sh
index c7c0e6b..8762d36 100755
--- a/rgmanager/src/resources/postgres-8.sh
+++ b/rgmanager/src/resources/postgres-8.sh
@@ -178,7 +178,8 @@ stop()
{
clog_service_stop $CLOG_INIT
- stop_generic_sigkill "$PSQL_pid_file" "$OCF_RESKEY_shutdown_wait" "$PSQL_kill_timeout"
+ ## Send -KILL signal immediately
+ stop_generic_sigkill "$PSQL_pid_file" 0 "$PSQL_kill_timeout"
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 be7b548..171ecd1 100644
--- a/rgmanager/src/resources/utils/ra-skelet.sh
+++ b/rgmanager/src/resources/utils/ra-skelet.sh
@@ -102,9 +102,13 @@ stop_generic_sigkill() {
declare kill_timeout="$3"
declare pid
- stop_generic "$pid_file" "$stop_timeout"
- if [ $? -eq 0 ]; then
- return 0;
+ ## 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"
+ if [ $? -eq 0 ]; then
+ return 0;
+ fi
fi
read pid < "$pid_file"