integ/base/cluster-resource-agents/debian/patches/0006-Patch-postgresql-environment-for-Debian.patch
Charles Short 2527c5ac75 debian: Specify the correct paths for pgsql
Correct the paths for the following defaults:
- OCF_RESKEY_pgctl_default
- OCF_RESKEY_pgdata_default
- OCF_RESKEY_socketdir_default

Test Plan
PASS Build resource-agents package
PASS Build ISO
PASS Unlock system

Story: 2009101
Task: 43317

Depends-On: https://review.opendev.org/c/starlingx/utilities/+/840497

Signed-off-by: Charles Short <charles.short@windriver.com>
Change-Id: I8eab1ff7a39222dce9c2b6c0094338e70c03c1e4
2022-05-16 10:15:40 +03:00

108 lines
3.8 KiB
Diff

From be107484af12c6c4875febd6fe1a6b987ecec587 Mon Sep 17 00:00:00 2001
From: Scott Little <scott.little@windriver.com>
Date: Mon, 2 Oct 2017 15:12:59 -0400
Subject: [PATCH 06/13] Patch postgresql environment for Debian
Adapt CentOS patch to Debian.
Signed-off-by: Scott Little <scott.little@windriver.com>
Signed-off-by: Charles Short <charles.short@windriver.com>
Signed-off-by: Dan Voiculeasa <dan.voiculeasa@windriver.com>
---
heartbeat/pgsql | 29 +++++++++++++++++++++++------
1 file changed, 23 insertions(+), 6 deletions(-)
diff --git a/heartbeat/pgsql b/heartbeat/pgsql
index cce4e1c..87bc486 100755
--- a/heartbeat/pgsql
+++ b/heartbeat/pgsql
@@ -43,9 +43,10 @@ get_pgsql_param() {
}
# Defaults
-OCF_RESKEY_pgctl_default=/usr/bin/pg_ctl
+OCF_RESKEY_pgctl_default=/usr/lib/postgresql/13/bin/pg_ctl
OCF_RESKEY_psql_default=/usr/bin/psql
-OCF_RESKEY_pgdata_default=/var/lib/pgsql/data
+OCF_RESKEY_pgdata_default=/var/lib/postgresql/13/main/
+OCF_RESKEY_pgconf_default=/etc/postgresql
OCF_RESKEY_pgdba_default=postgres
OCF_RESKEY_pghost_default=""
OCF_RESKEY_pgport_default=5432
@@ -54,7 +55,7 @@ OCF_RESKEY_start_opt_default=""
OCF_RESKEY_ctl_opt_default=""
OCF_RESKEY_pgdb_default=template1
OCF_RESKEY_logfile_default=/dev/null
-OCF_RESKEY_socketdir_default=""
+OCF_RESKEY_socketdir_default="/var/run/postgresql"
OCF_RESKEY_stop_escalate_default=90
OCF_RESKEY_monitor_user_default=""
OCF_RESKEY_monitor_password_default=""
@@ -79,11 +80,12 @@ OCF_RESKEY_replication_slot_name_default=""
: ${OCF_RESKEY_pgctl=${OCF_RESKEY_pgctl_default}}
: ${OCF_RESKEY_psql=${OCF_RESKEY_psql_default}}
: ${OCF_RESKEY_pgdata=${OCF_RESKEY_pgdata_default}}
+: ${OCF_RESKEY_pgconf=${OCF_RESKEY_pgconf_default}}
: ${OCF_RESKEY_pgdba=${OCF_RESKEY_pgdba_default}}
: ${OCF_RESKEY_pghost=${OCF_RESKEY_pghost_default}}
: ${OCF_RESKEY_pgport=${OCF_RESKEY_pgport_default}}
: ${OCF_RESKEY_pglibs=${OCF_RESKEY_pglibs_default}}
-: ${OCF_RESKEY_config=${OCF_RESKEY_pgdata}/postgresql.conf}
+: ${OCF_RESKEY_config=${OCF_RESKEY_pgconf}/postgresql.conf}
: ${OCF_RESKEY_start_opt=${OCF_RESKEY_start_opt_default}}
: ${OCF_RESKEY_ctl_opt=${OCF_RESKEY_ctl_opt_default}}
: ${OCF_RESKEY_pgdb=${OCF_RESKEY_pgdb_default}}
@@ -182,6 +184,14 @@ Path to PostgreSQL data directory.
<content type="string" default="${OCF_RESKEY_pgdata_default}" />
</parameter>
+<parameter name="pgconf" unique="0" required="0">
+<longdesc lang="en">
+Path to PostgreSQL config directory.
+</longdesc>
+<shortdesc lang="en">pgconf</shortdesc>
+<content type="string" default="${OCF_RESKEY_pgconf_default}" />
+</parameter>
+
<parameter name="pgdba" unique="0" required="0">
<longdesc lang="en">
User that owns PostgreSQL.
@@ -245,7 +255,7 @@ SQL script that will be used for monitor operations.
Path to the PostgreSQL configuration file for the instance.
</longdesc>
<shortdesc lang="en">Configuration file</shortdesc>
-<content type="string" default="${OCF_RESKEY_pgdata}/postgresql.conf" />
+<content type="string" default="${OCF_RESKEY_pgconf}/postgresql.conf" />
</parameter>
<parameter name="pgdb" unique="0" required="0">
@@ -634,6 +644,12 @@ pgsql_real_start() {
fi
fi
+ # STX: Create an unversioned symlink under /var/run so SM can easily
+ # find the PID file.
+ if [ ! -h $PIDFILE_SYMLINK ]; then
+ /bin/ln -s $PIDFILE $PIDFILE_SYMLINK
+ fi
+
ocf_log info "PostgreSQL is started."
return $rc
}
@@ -2150,10 +2166,11 @@ then
fi
PIDFILE=${OCF_RESKEY_pgdata}/postmaster.pid
+PIDFILE_SYMLINK=/var/run/postmaster.pid
BACKUPLABEL=${OCF_RESKEY_pgdata}/backup_label
RESOURCE_NAME=`echo $OCF_RESOURCE_INSTANCE | cut -d ":" -f 1`
PGSQL_WAL_RECEIVER_STATUS_ATTR="${RESOURCE_NAME}-receiver-status"
-RECOVERY_CONF=${OCF_RESKEY_pgdata}/recovery.conf
+RECOVERY_CONF=${OCF_RESKEY_pgconf}/recovery.conf
NODENAME=$(ocf_local_nodename | tr '[A-Z]' '[a-z]')
USE_STANDBY_SIGNAL=false
--
2.36.1