Blame SOURCES/bz1744431-pgsql-2-prevent-incorrect-status-start.patch

ab36d8
From ac430f79c333d73e6cd59ae59178c7040e7dbfda Mon Sep 17 00:00:00 2001
ab36d8
From: Kazunori INOUE <kazunori_inoue@newson.co.jp>
ab36d8
Date: Wed, 8 May 2019 18:23:59 +0900
ab36d8
Subject: [PATCH] pgsql: enhance checks in pgsql_real_start to prevent
ab36d8
 incorrect status gets
ab36d8
ab36d8
---
ab36d8
 heartbeat/pgsql | 6 ++++--
ab36d8
 1 file changed, 4 insertions(+), 2 deletions(-)
ab36d8
ab36d8
diff --git a/heartbeat/pgsql b/heartbeat/pgsql
ab36d8
index 842dc0ac4..5d04618e6 100755
ab36d8
--- a/heartbeat/pgsql
ab36d8
+++ b/heartbeat/pgsql
ab36d8
@@ -483,7 +483,7 @@ runasowner() {
ab36d8
             "-q")
ab36d8
                 quietrun="-q"
ab36d8
                 shift 1;;
ab36d8
-            "warn"|"err")
ab36d8
+            "info"|"warn"|"err")
ab36d8
                 loglevel="-$1"
ab36d8
                 shift 1;;
ab36d8
             *)
ab36d8
@@ -544,7 +544,9 @@ pgsql_real_start() {
ab36d8
     local postgres_options
ab36d8
     local rc
ab36d8
 
ab36d8
-    if pgsql_status; then
ab36d8
+    pgsql_real_monitor info
ab36d8
+    rc=$?
ab36d8
+    if [ $rc -eq $OCF_SUCCESS -o $rc -eq $OCF_RUNNING_MASTER ]; then
ab36d8
         ocf_log info "PostgreSQL is already running. PID=`cat $PIDFILE`"
ab36d8
         if is_replication; then
ab36d8
             return $OCF_ERR_GENERIC