mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-22 22:56:29 +00:00
repmgr: prevent termination in corner-case situation
If neither the local node nor the upstream are available, and "standby_disconnect_on_failover" is set, attempting to fetch the walreceiver PID will result in repmgrd terminating. Add a check that the connection is valid before attempting to fetch the walreceiver PID. Addresses GitHub #675.
This commit is contained in:
@@ -363,6 +363,12 @@ enable_wal_receiver(PGconn *conn, bool wait_startup)
|
||||
/* make timeout configurable */
|
||||
int i, timeout = 30;
|
||||
|
||||
if (PQstatus(conn) != CONNECTION_OK)
|
||||
{
|
||||
log_error(_("database connection not available"));
|
||||
return UNKNOWN_PID;
|
||||
}
|
||||
|
||||
if (is_superuser_connection(conn, NULL) == false)
|
||||
{
|
||||
log_error(_("superuser connection required"));
|
||||
|
||||
Reference in New Issue
Block a user