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