From fdb3eb09b1441a328090f1cf67b6a6fdd4fa54a9 Mon Sep 17 00:00:00 2001 From: Jehan-Guillaume de Rorthais Date: Thu, 1 Oct 2020 15:40:27 +0200 Subject: [PATCH] pgsqlms: log an error message on recovery attempt failure Per discussion on gh issue #173: https://github.com/ClusterLabs/PAF/issues/173#issuecomment-653026500 --- script/pgsqlms | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/script/pgsqlms b/script/pgsqlms index 0d00958..2fb6db6 100755 --- a/script/pgsqlms +++ b/script/pgsqlms @@ -2096,7 +2096,6 @@ sub pgsql_notify_post_promote { # This is called before a demote occurs. sub pgsql_notify_pre_demote { my $rc; - my %cdata; # do nothing if the local node will not be demoted return $OCF_SUCCESS unless scalar @@ -2128,11 +2127,18 @@ sub pgsql_notify_pre_demote { # Either the instance managed to start or it couldn't. # We rely on the pg_ctl '-w' switch to take care of this. If it couldn't # start, this error will be catched up later during the various checks - _pg_ctl_start(); + if( _pg_ctl_start() == 0 ) { + my %cdata = _get_controldata(); - %cdata = _get_controldata(); + ocf_log( 'info', 'Recovery of %s succeed', $OCF_RESOURCE_INSTANCE ); + ocf_log( 'info', 'State is "%s" after recovery attempt', + $cdata{'state'} ); + } + else { + ocf_log( 'err', 'Could not recover failing primary %s', + $OCF_RESOURCE_INSTANCE ); + } - ocf_log( 'info', 'State is "%s" after recovery attempt', $cdata{'state'} ); # whatever the result, it is ignored by pacemaker. return $OCF_SUCCESS;