diff --git a/INSTALL b/INSTALL index 36c438b7..70d4edfe 100644 --- a/INSTALL +++ b/INSTALL @@ -5,19 +5,13 @@ This module is for monitor a cluster, to install follow next steps On Primary: -1) Install last_xlog_replay_timestamp() function -2) Create tables for repmgr configuration and monitor (see repmgr.sql) -3) Edit repmgr.conf +1) Create tables for repmgr configuration and monitor (see repmgr.sql) +2) Edit repmgr.conf On Standby: -1) Install xlog_replay_time module - NOTE: this should be done before the standby starts for the first time, - the reason is that when the standby tries to replay WAL segment - where the function was created this file should exist or it will - be an error. -2) Start replica -3) Edit repmgr.conf +1) Start replica +2) Edit repmgr.conf @@ -28,11 +22,6 @@ make USE_PGXS=1 make install USE_PGXS=1 -Installing last_xlog_replay_timestamp() function -------------------------------------------------- -psql -f $PGDIR/share/contrib/xlog_replay_time.sql - - repmgr.conf ------------ diff --git a/main.c b/main.c index 342e84d6..9d7d0b85 100644 --- a/main.c +++ b/main.c @@ -195,7 +195,6 @@ MonitorExecute(void) char last_wal_primary_location[MAXLEN]; char last_wal_standby_received[MAXLEN]; char last_wal_standby_applied[MAXLEN]; - char last_wal_standby_timestamp[MAXLEN]; unsigned long long int lsn_primary; unsigned long long int lsn_standby_received; @@ -204,7 +203,7 @@ MonitorExecute(void) /* Get local xlog info */ sprintf(sqlquery, "SELECT CURRENT_TIMESTAMP, pg_last_xlog_receive_location(), " - "pg_last_xlog_replay_location(), get_last_xlog_replay_timestamp()"); + "pg_last_xlog_replay_location()"); res = PQexec(myLocalConn, sqlquery); if (PQresultStatus(res) != PGRES_TUPLES_OK) @@ -217,7 +216,6 @@ MonitorExecute(void) strcpy(monitor_standby_timestamp, PQgetvalue(res, 0, 0)); strcpy(last_wal_standby_received , PQgetvalue(res, 0, 1)); strcpy(last_wal_standby_applied , PQgetvalue(res, 0, 2)); - strcpy(last_wal_standby_timestamp, PQgetvalue(res, 0, 3)); PQclear(res); /* Get primary xlog info */ @@ -246,13 +244,12 @@ MonitorExecute(void) "INSERT INTO repl_status " "VALUES(%d, %d, '%s'::timestamp with time zone, " " '%s', '%s', " - " '%s'::timestamp with time zone, " " %lld, %lld)", primaryId, myLocalId, monitor_standby_timestamp, last_wal_primary_location, - last_wal_standby_received, last_wal_standby_timestamp, + last_wal_standby_received, (lsn_primary - lsn_standby_received), - (lsn_standby_applied - lsn_standby_received)); + (lsn_standby_received - lsn_standby_applied)); /* * Execute the query asynchronously, but don't check for a result. We diff --git a/repmgr.sql b/repmgr.sql index 65205618..80448c9e 100644 --- a/repmgr.sql +++ b/repmgr.sql @@ -12,7 +12,6 @@ CREATE TABLE repl_status( last_monitor_timestamp TIMESTAMP WITH TIME ZONE NOT NULL, last_wal_primary_location TEXT NOT NULL, last_wal_standby_location TEXT NOT NULL, - last_wal_standby_timestamp TIMESTAMP WITH TIME ZONE NOT NULL, replication_lag BIGINT NOT NULL, apply_lag BIGINT NOT NULL ); diff --git a/sql_utils/Makefile b/sql_utils/Makefile deleted file mode 100644 index 0d72bede..00000000 --- a/sql_utils/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -# -# Makefile -# Copyright (c) 2ndQuadrant, 2010 -# - -MODULE_big = repmgr_wrapper_funcs -DATA_built=repmgr_wrapper_funcs.sql -DATA=uninstall_repmgr_wrapper_funcs.sql -OBJS=repmgr_wrapper_funcs.o - -ifdef USE_PGXS -PGXS := $(shell pg_config --pgxs) -include $(PGXS) -else -subdir = contrib/repmgr/sql_utils -top_builddir = ../../.. -include $(top_builddir)/src/Makefile.global -include $(top_srcdir)/contrib/contrib-global.mk -endif diff --git a/sql_utils/repmgr_wrapper_funcs.c b/sql_utils/repmgr_wrapper_funcs.c deleted file mode 100644 index 1624551b..00000000 --- a/sql_utils/repmgr_wrapper_funcs.c +++ /dev/null @@ -1,31 +0,0 @@ -/* - * repmgr_wrapper_funcs.c - * Copyright (c) 2ndQuadrant, 2010 - * - * Expose some backend functions in SQL - */ - -#include "postgres.h" -#include "fmgr.h" -#include "access/xlog.h" - -PG_MODULE_MAGIC; - -Datum last_xlog_replay_timestamp(PG_FUNCTION_ARGS); - -PG_FUNCTION_INFO_V1(last_xlog_replay_timestamp); - -Datum -last_xlog_replay_timestamp(PG_FUNCTION_ARGS) -{ -TimestampTz rTime; -bool fromStream; - - if (!RecoveryInProgress()) - PG_RETURN_NULL(); - else - { - GetXLogReceiptTime(&rTime, &fromStream); - PG_RETURN_TIMESTAMPTZ(rTime); - } -} diff --git a/sql_utils/repmgr_wrapper_funcs.sql.in b/sql_utils/repmgr_wrapper_funcs.sql.in deleted file mode 100644 index ffd9c64d..00000000 --- a/sql_utils/repmgr_wrapper_funcs.sql.in +++ /dev/null @@ -1,9 +0,0 @@ -/* - * repmgr_wrapper_function.sql - * Copyright (c) 2ndQuadrant, 2010 - * - */ - -CREATE FUNCTION get_last_xlog_replay_timestamp() RETURNS timestamp with time zone -AS 'MODULE_PATHNAME', 'last_xlog_replay_timestamp' -LANGUAGE C STRICT; diff --git a/sql_utils/uninstall_repmgr_wrapper_funcs.sql b/sql_utils/uninstall_repmgr_wrapper_funcs.sql deleted file mode 100644 index 46addcde..00000000 --- a/sql_utils/uninstall_repmgr_wrapper_funcs.sql +++ /dev/null @@ -1 +0,0 @@ -DROP FUNCTION get_last_xlog_replay_timestamp();