mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-22 22:56:29 +00:00
Rename functions which return an LSN for clarity
This commit is contained in:
20
dbutils.c
20
dbutils.c
@@ -4551,9 +4551,16 @@ reset_voting_status(PGconn *conn)
|
||||
/* replication status functions */
|
||||
/* ============================ */
|
||||
|
||||
|
||||
/*
|
||||
* Returns the current LSN on the primary.
|
||||
*
|
||||
* This just executes "pg_current_wal_lsn()".
|
||||
*
|
||||
* Function "get_node_current_lsn()" below will return the latest
|
||||
* LSN regardless of recovery state.
|
||||
*/
|
||||
XLogRecPtr
|
||||
get_current_wal_lsn(PGconn *conn)
|
||||
get_primary_current_lsn(PGconn *conn)
|
||||
{
|
||||
PGresult *res = NULL;
|
||||
XLogRecPtr ptr = InvalidXLogRecPtr;
|
||||
@@ -4577,6 +4584,7 @@ get_current_wal_lsn(PGconn *conn)
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
XLogRecPtr
|
||||
get_last_wal_receive_location(PGconn *conn)
|
||||
{
|
||||
@@ -4602,9 +4610,11 @@ get_last_wal_receive_location(PGconn *conn)
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Returns the latest LSN for the node regardless of recovery state.
|
||||
*/
|
||||
XLogRecPtr
|
||||
get_current_lsn(PGconn *conn)
|
||||
get_node_current_lsn(PGconn *conn)
|
||||
{
|
||||
PQExpBufferData query;
|
||||
PGresult *res = NULL;
|
||||
@@ -4678,7 +4688,7 @@ get_current_lsn(PGconn *conn)
|
||||
|
||||
if (PQresultStatus(res) != PGRES_TUPLES_OK)
|
||||
{
|
||||
log_db_error(conn, query.data, _("unable to execute get_current_lsn()"));
|
||||
log_db_error(conn, query.data, _("unable to execute get_node_current_lsn()"));
|
||||
}
|
||||
else if (!PQgetisnull(res, 0, 0))
|
||||
{
|
||||
|
||||
@@ -538,9 +538,9 @@ bool get_new_primary(PGconn *conn, int *primary_node_id);
|
||||
void reset_voting_status(PGconn *conn);
|
||||
|
||||
/* replication status functions */
|
||||
XLogRecPtr get_current_wal_lsn(PGconn *conn);
|
||||
XLogRecPtr get_primary_current_lsn(PGconn *conn);
|
||||
XLogRecPtr get_node_current_lsn(PGconn *conn);
|
||||
XLogRecPtr get_last_wal_receive_location(PGconn *conn);
|
||||
XLogRecPtr get_current_lsn(PGconn *conn);
|
||||
void init_replication_info(ReplInfo *replication_info);
|
||||
bool get_replication_info(PGconn *conn, ReplInfo *replication_info);
|
||||
int get_replication_lag_seconds(PGconn *conn);
|
||||
|
||||
@@ -2532,7 +2532,7 @@ do_standby_follow(void)
|
||||
t_system_identification local_identification = T_SYSTEM_IDENTIFICATION_INITIALIZER;
|
||||
|
||||
bool can_follow;
|
||||
XLogRecPtr local_xlogpos = get_current_lsn(local_conn);
|
||||
XLogRecPtr local_xlogpos = get_node_current_lsn(local_conn);
|
||||
|
||||
/* Check local replication connection - we want to execute IDENTIFY_SYSTEM
|
||||
* to get the current timeline ID, which might not yet be written to
|
||||
@@ -3234,7 +3234,7 @@ do_standby_switchover(void)
|
||||
* to unexpected behaviour when the standby is promoted.
|
||||
*
|
||||
* For switchover we'll mandate that WAL replay *must not* be paused.
|
||||
* For a promote operation we can proceed if WAL replay is paused
|
||||
* For a promote operation we can proceed if WAL replay is paused and
|
||||
* there is no more available WAL to be replayed, as we can be sure the
|
||||
* primary is down already, but in a switchover context there's
|
||||
* potentially a window for more WAL to be received before we shut down
|
||||
|
||||
@@ -3321,7 +3321,7 @@ check_node_can_attach(TimeLineID local_tli, XLogRecPtr local_xlogpos, PGconn *fo
|
||||
|
||||
if (follow_target_identification.timeline == local_tli)
|
||||
{
|
||||
XLogRecPtr follow_target_xlogpos = get_current_lsn(follow_target_conn);
|
||||
XLogRecPtr follow_target_xlogpos = get_node_current_lsn(follow_target_conn);
|
||||
|
||||
if (local_xlogpos == InvalidXLogRecPtr || follow_target_xlogpos == InvalidXLogRecPtr)
|
||||
{
|
||||
|
||||
@@ -2242,7 +2242,7 @@ update_monitoring_history(void)
|
||||
local_node_info.node_id);
|
||||
}
|
||||
|
||||
primary_last_wal_location = get_current_wal_lsn(primary_conn);
|
||||
primary_last_wal_location = get_primary_current_lsn(primary_conn);
|
||||
|
||||
if (primary_last_wal_location == InvalidXLogRecPtr)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user