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

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