mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-25 16:16:29 +00:00
repmgrd: use PQping() as a first test of whether an upstream node is available
It's possible the upstream node may be temporarily not accepting connections but is still running, so we only confirm that connections are not possible once PQping() reports a negative result. This feature has been adapted from repmgr4.
This commit is contained in:
16
dbutils.c
16
dbutils.c
@@ -2137,3 +2137,19 @@ get_last_wal_receive_location(PGconn *conn)
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
is_server_available(const char *conninfo)
|
||||
{
|
||||
PGPing status = PQping(conninfo);
|
||||
|
||||
log_verbose(LOG_DEBUG, "is_server_available(): ping status for \"%s\" is %i\n", conninfo, (int)status);
|
||||
|
||||
if (status == PQPING_OK)
|
||||
return true;
|
||||
|
||||
log_warning("is_server_available(): ping status for \"%s\" is %i\n", conninfo, (int)status);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user