mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-24 15:46:29 +00:00
Count witness and zero-priority nodes in visibility check
This commit is contained in:
20
dbutils.c
20
dbutils.c
@@ -4898,7 +4898,7 @@ init_replication_info(ReplInfo *replication_info)
|
||||
|
||||
|
||||
bool
|
||||
get_replication_info(PGconn *conn, ReplInfo *replication_info)
|
||||
get_replication_info(PGconn *conn, t_server_type node_type, ReplInfo *replication_info)
|
||||
{
|
||||
PQExpBufferData query;
|
||||
PGresult *res = NULL;
|
||||
@@ -4960,11 +4960,21 @@ get_replication_info(PGconn *conn, ReplInfo *replication_info)
|
||||
" END AS wal_replay_paused, ");
|
||||
}
|
||||
|
||||
if (node_type == WITNESS)
|
||||
{
|
||||
appendPQExpBufferStr(&query,
|
||||
" repmgr.get_upstream_last_seen() AS upstream_last_seen");
|
||||
}
|
||||
else
|
||||
{
|
||||
appendPQExpBufferStr(&query,
|
||||
" CASE WHEN pg_catalog.pg_is_in_recovery() IS FALSE "
|
||||
" THEN -1 "
|
||||
" ELSE repmgr.get_upstream_last_seen() "
|
||||
" END AS upstream_last_seen ");
|
||||
}
|
||||
|
||||
appendPQExpBufferStr(&query,
|
||||
" CASE WHEN pg_catalog.pg_is_in_recovery() IS FALSE "
|
||||
" THEN -1 "
|
||||
" ELSE repmgr.get_upstream_last_seen() "
|
||||
" END AS upstream_last_seen "
|
||||
" ) q ");
|
||||
|
||||
log_verbose(LOG_DEBUG, "get_replication_info():\n%s", query.data);
|
||||
|
||||
Reference in New Issue
Block a user