Ensure witness node sets last upstream seen time

This commit is contained in:
Ian Barwick
2019-03-14 10:53:12 +09:00
committed by Ian Barwick
parent 048bad1c88
commit fc636b1bd2
5 changed files with 27 additions and 17 deletions

View File

@@ -5195,7 +5195,7 @@ set_upstream_last_seen(PGconn *conn)
int
get_upstream_last_seen(PGconn *conn)
get_upstream_last_seen(PGconn *conn, t_server_type node_type)
{
PQExpBufferData query;
PGresult *res = NULL;
@@ -5203,11 +5203,19 @@ get_upstream_last_seen(PGconn *conn)
initPQExpBuffer(&query);
appendPQExpBufferStr(&query,
"SELECT CASE WHEN pg_catalog.pg_is_in_recovery() IS FALSE "
" THEN -1 "
" ELSE repmgr.get_upstream_last_seen() "
" END AS upstream_last_seen ");
if (node_type == WITNESS)
{
appendPQExpBufferStr(&query,
"SELECT repmgr.get_upstream_last_seen()");
}
else
{
appendPQExpBufferStr(&query,
"SELECT CASE WHEN pg_catalog.pg_is_in_recovery() IS FALSE "
" THEN -1 "
" ELSE repmgr.get_upstream_last_seen() "
" END AS upstream_last_seen ");
}
res = PQexec(conn, query.data);