From 78871e7bdb972ac7256cb084fac7e82684dbcbab Mon Sep 17 00:00:00 2001 From: Arslan Ahmad Date: Mon, 1 Jun 2026 18:32:10 +0530 Subject: [PATCH] - pgsqlms: use monitor_user and monitor_password for monitor operations Includes fixes for stop operation failure when incorrect monitor_user/monitor_password is specified Resolves: RHEL-150842 --- ...en-monitor_password-is-not-specified.patch | 34 +++++++++++++++++++ resource-agents.spec | 14 ++++---- 2 files changed, 41 insertions(+), 7 deletions(-) diff --git a/RHEL-150842-pgsqlms-use-monitor_user-for-monitor-calls-and-use-pgpass-when-monitor_password-is-not-specified.patch b/RHEL-150842-pgsqlms-use-monitor_user-for-monitor-calls-and-use-pgpass-when-monitor_password-is-not-specified.patch index d13230c..02f208b 100644 --- a/RHEL-150842-pgsqlms-use-monitor_user-for-monitor-calls-and-use-pgpass-when-monitor_password-is-not-specified.patch +++ b/RHEL-150842-pgsqlms-use-monitor_user-for-monitor-calls-and-use-pgpass-when-monitor_password-is-not-specified.patch @@ -117,3 +117,37 @@ Path to the directory storing the PostgreSQL binaries. The agent uses psql, pg_isready, pg_controldata and pg_ctl. +@@ -1523,6 +1567,7 @@ + my $rc; + my $state; + my $pidfile = "$datadir/postmaster.pid"; ++ my $pgisready_rc; + # Add 60s to the timeout or use a 24h timeout fallback to make sure + # Pacemaker will give up before us and take decisions + my $timeout = ( _get_action_timeout() || 60*60*24 ) + 60; +@@ -1536,9 +1581,22 @@ + return $OCF_SUCCESS; + } + elsif ( $rc != $OCF_SUCCESS and $rc != $OCF_RUNNING_MASTER ) { +- ocf_exit_reason( 'Unexpected state for instance "%s" (returned %d)', +- $OCF_RESOURCE_INSTANCE, $rc ); +- return $OCF_ERR_GENERIC; ++ ocf_log( 'debug', 'pgsql_stop: monitor failed (rc=%d), checking with pg_isready', $rc ); ++ ++ $pgisready_rc = _pg_isready(); ++ if ( $pgisready_rc == 0 or $pgisready_rc == 1 ) { ++ ocf_log( 'info', 'Instance "%s" is running (pg_isready=%d), proceeding with stop despite monitor failure', ++ $OCF_RESOURCE_INSTANCE, $pgisready_rc ); ++ } ++ elsif ( $pgisready_rc == 2 ) { ++ ocf_log( 'debug', 'pgsql_stop: pg_isready indicates instance is not listening' ); ++ return _confirm_stopped(); ++ } ++ else { ++ ocf_exit_reason( 'Unexpected state for instance "%s" (monitor returned %d, pg_isready returned %d)', ++ $OCF_RESOURCE_INSTANCE, $rc, $pgisready_rc ); ++ return $OCF_ERR_GENERIC; ++ } + } + + # diff --git a/resource-agents.spec b/resource-agents.spec index d4ea1ab..9fc02a7 100644 --- a/resource-agents.spec +++ b/resource-agents.spec @@ -45,7 +45,7 @@ Name: resource-agents Summary: Open Source HA Reusable Cluster Resource Scripts Version: 4.10.0 -Release: 120%{?rcver:%{rcver}}%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} +Release: 121%{?rcver:%{rcver}}%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} License: GPLv2+ and LGPLv2+ URL: https://github.com/ClusterLabs/resource-agents Source0: %{upstream_prefix}-%{upstream_version}.tar.gz @@ -859,6 +859,12 @@ rm -rf %{buildroot}/usr/share/doc/resource-agents %{_usr}/lib/ocf/lib/heartbeat/OCF_*.pm %changelog +* Mon Jun 01 2026 Arslan Ahmad - 4.10.0-121 +- pgsqlms: use monitor_user for monitor-calls and use .pgpass when + monitor_password is not specified + + Resolves: RHEL-150842 + * Thu May 28 2026 Oyvind Albrigtsen - 4.10.0-120 - iSCSILogicalUnit: add block size override and backstore type selection @@ -870,12 +876,6 @@ rm -rf %{buildroot}/usr/share/doc/resource-agents Resolves: RHEL-179069 -* Mon May 25 2026 Arslan Ahmad - 4.10.0-118 -- pgsqlms: use monitor_user for monitor-calls and use .pgpass when - monitor_password is not specified - - Resolves: RHEL-150842 - * Wed May 20 2026 Oyvind Albrigtsen - 4.10.0-117 - podman-etcd: fix port 2380 binding race - podman-etcd: fix machine deletion deadlock