mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-22 22:56:29 +00:00
Support pre-10 WAL functions
This commit is contained in:
11
dbutils.c
11
dbutils.c
@@ -2775,8 +2775,15 @@ get_last_wal_receive_location(PGconn *conn)
|
|||||||
PGresult *res;
|
PGresult *res;
|
||||||
XLogRecPtr ptr = InvalidXLogRecPtr;
|
XLogRecPtr ptr = InvalidXLogRecPtr;
|
||||||
|
|
||||||
// pre-10 !!!
|
|
||||||
res = PQexec(conn, "SELECT pg_catalog.pg_last_wal_receive_lsn()");
|
if (server_version_num >= 100000)
|
||||||
|
{
|
||||||
|
res = PQexec(conn, "SELECT pg_catalog.pg_last_wal_receive_lsn()");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
res = PQexec(conn, "SELECT pg_catalog.pg_last_xlog_receive_location()");
|
||||||
|
}
|
||||||
|
|
||||||
if (PQresultStatus(res) == PGRES_TUPLES_OK)
|
if (PQresultStatus(res) == PGRES_TUPLES_OK)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ PGconn *local_conn = NULL;
|
|||||||
/* Collate command line errors here for friendlier reporting */
|
/* Collate command line errors here for friendlier reporting */
|
||||||
static ItemList cli_errors = { NULL, NULL };
|
static ItemList cli_errors = { NULL, NULL };
|
||||||
|
|
||||||
|
int server_version_num = 0;
|
||||||
bool startup_event_logged = false;
|
bool startup_event_logged = false;
|
||||||
|
|
||||||
MonitoringState monitoring_state = MS_NORMAL;
|
MonitoringState monitoring_state = MS_NORMAL;
|
||||||
@@ -286,6 +287,12 @@ main(int argc, char **argv)
|
|||||||
/* abort if local node not available at startup */
|
/* abort if local node not available at startup */
|
||||||
local_conn = establish_db_connection(config_file_options.conninfo, true);
|
local_conn = establish_db_connection(config_file_options.conninfo, true);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* store the server version number - we'll need this to generate
|
||||||
|
* version-dependent queries etc.
|
||||||
|
*/
|
||||||
|
server_version_num = get_server_version(local_conn, NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* sanity checks
|
* sanity checks
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ extern instr_time degraded_monitoring_start;
|
|||||||
extern t_configuration_options config_file_options;
|
extern t_configuration_options config_file_options;
|
||||||
extern t_node_info local_node_info;
|
extern t_node_info local_node_info;
|
||||||
extern PGconn *local_conn;
|
extern PGconn *local_conn;
|
||||||
extern bool startup_event_logged;
|
extern bool startup_event_logged;
|
||||||
|
extern int server_version_num;
|
||||||
|
|
||||||
PGconn *try_reconnect(const char *conninfo, NodeStatus *node_status);
|
PGconn *try_reconnect(const char *conninfo, NodeStatus *node_status);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user