mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-26 16:46:28 +00:00
standby clone: check upstream connections after data copy operation
With long-running copy operations, it's possible the connection(s) to the primary/source server may go away for some reason, so recheck their availability before attempting to reuse.
This commit is contained in:
19
dbutils.c
19
dbutils.c
@@ -4272,6 +4272,25 @@ connection_ping(PGconn *conn)
|
||||
}
|
||||
|
||||
|
||||
ExecStatusType
|
||||
connection_ping_reconnect(PGconn *conn)
|
||||
{
|
||||
ExecStatusType ping_result = connection_ping(conn);
|
||||
|
||||
if (PQstatus(conn) != CONNECTION_OK)
|
||||
{
|
||||
log_warning(_("connection error, attempting to reset"));
|
||||
log_detail("%s", PQerrorMessage(conn));
|
||||
PQreset(conn);
|
||||
ping_result = connection_ping(conn);
|
||||
}
|
||||
|
||||
log_verbose(LOG_DEBUG, "connection_ping_reconnect(): result is %s", PQresStatus(ping_result));
|
||||
|
||||
return ping_result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ==================== */
|
||||
/* monitoring functions */
|
||||
|
||||
Reference in New Issue
Block a user