mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-26 08:36:30 +00:00
Rename "..._primary_last_seen" functions to "..._upstream_last_seen"
As that better reflects what they do.
This commit is contained in:
30
dbutils.c
30
dbutils.c
@@ -4818,7 +4818,7 @@ init_replication_info(ReplInfo *replication_info)
|
||||
replication_info->replication_lag_time = 0;
|
||||
replication_info->receiving_streamed_wal = true;
|
||||
replication_info->wal_replay_paused = false;
|
||||
replication_info->primary_last_seen = -1;
|
||||
replication_info->upstream_last_seen = -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -4846,7 +4846,7 @@ get_replication_info(PGconn *conn, ReplInfo *replication_info)
|
||||
" END AS replication_lag_time, "
|
||||
" last_wal_receive_lsn >= last_wal_replay_lsn AS receiving_streamed_wal, "
|
||||
" wal_replay_paused, "
|
||||
" primary_last_seen "
|
||||
" upstream_last_seen "
|
||||
" FROM ( "
|
||||
" SELECT CURRENT_TIMESTAMP AS ts, "
|
||||
" pg_catalog.pg_last_xact_replay_timestamp() AS last_xact_replay_timestamp, ");
|
||||
@@ -4888,8 +4888,8 @@ get_replication_info(PGconn *conn, ReplInfo *replication_info)
|
||||
appendPQExpBufferStr(&query,
|
||||
" CASE WHEN pg_catalog.pg_is_in_recovery() IS FALSE "
|
||||
" THEN -1 "
|
||||
" ELSE repmgr.get_primary_last_seen() "
|
||||
" END AS primary_last_seen "
|
||||
" ELSE repmgr.get_upstream_last_seen() "
|
||||
" END AS upstream_last_seen "
|
||||
" ) q ");
|
||||
|
||||
log_verbose(LOG_DEBUG, "get_replication_info():\n%s", query.data);
|
||||
@@ -4911,7 +4911,7 @@ get_replication_info(PGconn *conn, ReplInfo *replication_info)
|
||||
replication_info->replication_lag_time = atoi(PQgetvalue(res, 0, 4));
|
||||
replication_info->receiving_streamed_wal = atobool(PQgetvalue(res, 0, 5));
|
||||
replication_info->wal_replay_paused = atobool(PQgetvalue(res, 0, 6));
|
||||
replication_info->primary_last_seen = atoi(PQgetvalue(res, 0, 7));
|
||||
replication_info->upstream_last_seen = atoi(PQgetvalue(res, 0, 7));
|
||||
}
|
||||
|
||||
termPQExpBuffer(&query);
|
||||
@@ -5097,7 +5097,7 @@ is_downstream_node_attached(PGconn *conn, char *node_name)
|
||||
|
||||
|
||||
void
|
||||
set_primary_last_seen(PGconn *conn)
|
||||
set_upstream_last_seen(PGconn *conn)
|
||||
{
|
||||
PQExpBufferData query;
|
||||
PGresult *res = NULL;
|
||||
@@ -5105,13 +5105,13 @@ set_primary_last_seen(PGconn *conn)
|
||||
initPQExpBuffer(&query);
|
||||
|
||||
appendPQExpBufferStr(&query,
|
||||
"SELECT repmgr.set_primary_last_seen()");
|
||||
"SELECT repmgr.set_upstream_last_seen()");
|
||||
|
||||
res = PQexec(conn, query.data);
|
||||
|
||||
if (PQresultStatus(res) != PGRES_TUPLES_OK)
|
||||
{
|
||||
log_db_error(conn, query.data, _("unable to execute repmgr.set_primary_last_seen()"));
|
||||
log_db_error(conn, query.data, _("unable to execute repmgr.set_upstream_last_seen()"));
|
||||
}
|
||||
|
||||
termPQExpBuffer(&query);
|
||||
@@ -5120,35 +5120,35 @@ set_primary_last_seen(PGconn *conn)
|
||||
|
||||
|
||||
int
|
||||
get_primary_last_seen(PGconn *conn)
|
||||
get_upstream_last_seen(PGconn *conn)
|
||||
{
|
||||
PQExpBufferData query;
|
||||
PGresult *res = NULL;
|
||||
int primary_last_seen = -1;
|
||||
int upstream_last_seen = -1;
|
||||
|
||||
initPQExpBuffer(&query);
|
||||
|
||||
appendPQExpBufferStr(&query,
|
||||
"SELECT CASE WHEN pg_catalog.pg_is_in_recovery() IS FALSE "
|
||||
" THEN -1 "
|
||||
" ELSE repmgr.get_primary_last_seen() "
|
||||
" END AS primary_last_seen ");
|
||||
" ELSE repmgr.get_upstream_last_seen() "
|
||||
" END AS upstream_last_seen ");
|
||||
|
||||
res = PQexec(conn, query.data);
|
||||
|
||||
if (PQresultStatus(res) != PGRES_TUPLES_OK)
|
||||
{
|
||||
log_db_error(conn, query.data, _("unable to execute repmgr.get_primary_last_seen()"));
|
||||
log_db_error(conn, query.data, _("unable to execute repmgr.get_upstream_last_seen()"));
|
||||
}
|
||||
else
|
||||
{
|
||||
primary_last_seen = atoi(PQgetvalue(res, 0, 0));
|
||||
upstream_last_seen = atoi(PQgetvalue(res, 0, 0));
|
||||
}
|
||||
|
||||
termPQExpBuffer(&query);
|
||||
PQclear(res);
|
||||
|
||||
return primary_last_seen;
|
||||
return upstream_last_seen;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user