Blame SOURCES/bz1744190-pgsql-2-improve-start-checks.patch

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