Blob Blame History Raw
From e56d0e1727bf84d0664db544a129a0237a1757c0 Mon Sep 17 00:00:00 2001
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
Date: Fri, 11 Sep 2020 10:12:21 +0200
Subject: [PATCH 1/2] pgsql: lower-case application_name to avoid issues with
 upper-case hostnames

---
 heartbeat/pgsql | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/heartbeat/pgsql b/heartbeat/pgsql
index 99e074287..de9f750c5 100755
--- a/heartbeat/pgsql
+++ b/heartbeat/pgsql
@@ -1960,7 +1960,7 @@ pgsql_validate_all() {
         else
             CHECK_XLOG_LOC_SQL="select pg_last_xlog_replay_location(),pg_last_xlog_receive_location()"
         fi
-        CHECK_REPLICATION_STATE_SQL="select application_name,upper(state),upper(sync_state) from pg_stat_replication"
+        CHECK_REPLICATION_STATE_SQL="select lower(application_name),upper(state),upper(sync_state) from pg_stat_replication"
 
         PGSQL_STATUS_ATTR="${RESOURCE_NAME}-status"
         PGSQL_DATA_STATUS_ATTR="${RESOURCE_NAME}-data-status"

From 5aee799878180bb8daca82aebc2290c2735045eb Mon Sep 17 00:00:00 2001
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
Date: Fri, 11 Sep 2020 10:13:47 +0200
Subject: [PATCH 2/2] pgsql: set exit-reason when failing due to remaining
 PGSQL.lock

---
 heartbeat/pgsql | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/heartbeat/pgsql b/heartbeat/pgsql
index de9f750c5..5a0628b7a 100755
--- a/heartbeat/pgsql
+++ b/heartbeat/pgsql
@@ -966,6 +966,9 @@ pgsql_real_monitor() {
     if ! pgsql_status
     then
         ocf_log info "PostgreSQL is down"
+        if [ "$__OCF_ACTION" = "monitor" ] && ! ocf_is_probe && [ -f $PGSQL_LOCK ]; then
+            ocf_exit_reason "My data may be inconsistent. You have to remove $PGSQL_LOCK file to force start."
+        fi
         return $OCF_NOT_RUNNING
     fi