Blame SOURCES/bz1744190-pgsql-1-set-primary-standby-initial-score.patch

02ddf4
From f8e1b1407b613657ebd90381d53e6a567b92b241 Mon Sep 17 00:00:00 2001
02ddf4
From: Kazutomo Nakahira <kazutomo_nakahira@newson.co.jp>
02ddf4
Date: Mon, 17 Dec 2018 14:15:24 +0900
02ddf4
Subject: [PATCH] Medium: pgsql: Set initial score for primary and hot standby
02ddf4
 in the probe.
02ddf4
02ddf4
---
02ddf4
 heartbeat/pgsql | 8 ++++++++
02ddf4
 1 file changed, 8 insertions(+)
02ddf4
02ddf4
diff --git a/heartbeat/pgsql b/heartbeat/pgsql
02ddf4
index 842dc0ac4..8ef84dd3e 100755
02ddf4
--- a/heartbeat/pgsql
02ddf4
+++ b/heartbeat/pgsql
02ddf4
@@ -974,11 +974,19 @@ pgsql_real_monitor() {
02ddf4
         case "$output" in
02ddf4
             f)  ocf_log debug "PostgreSQL is running as a primary."
02ddf4
                 if [ "$OCF_RESKEY_monitor_sql" = "$OCF_RESKEY_monitor_sql_default" ]; then
02ddf4
+                    if ocf_is_probe; then
02ddf4
+                        # Set initial score for primary.
02ddf4
+                        exec_with_retry 0 $CRM_MASTER -v $PROMOTE_ME
02ddf4
+                    fi
02ddf4
                     return $OCF_RUNNING_MASTER
02ddf4
                 fi
02ddf4
                 ;;
02ddf4
 
02ddf4
             t)  ocf_log debug "PostgreSQL is running as a hot standby."
02ddf4
+                if ocf_is_probe; then
02ddf4
+                    # Set initial score for hot standby.
02ddf4
+                    exec_with_retry 0 $CRM_MASTER -v $CAN_NOT_PROMOTE
02ddf4
+                fi
02ddf4
                 return $OCF_SUCCESS;;
02ddf4
 
02ddf4
             *)  ocf_exit_reason "$CHECK_MS_SQL output is $output"