Retrieve master connection info using "SHOW primary_conninfo" SQL query instead of parsing recovery.conf

This commit is contained in:
Benjamin Renard 2024-07-15 12:49:55 +02:00
parent 747331a9ec
commit a099e2f833
Signed by: bn8
GPG key ID: 3E2E1CE1907115BC

View file

@ -305,11 +305,11 @@ then
debug "Last replayed LSN: $LAST_REPLAYED_LSN"
# Get master connection information from recovery.conf file
MASTER_CONN_INFOS=$( egrep '^ *primary_conninfo' $RECOVERY_CONF|sed "s/^ *primary_conninfo *= *\(.\+\) *$/\1/" )
# Get master connection information from primary_conninfo configuration parameter
MASTER_CONN_INFOS=$( psql_get "SHOW primary_conninfo" )
if [ ! -n "$MASTER_CONN_INFOS" ]
then
echo "UNKNOWN: Can't retrieve master connection information form recovery.conf file"
echo "UNKNOWN: Can't retrieve master connection information from primary_conninfo configuration parameter"
exit 3
fi
debug "Master connection information: $MASTER_CONN_INFOS"