mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-22 22:56:29 +00:00
Initial changes for 9.3 support
This commit is contained in:
@@ -2,4 +2,3 @@
|
||||
|
||||
/* Only build repmgr for BDR */
|
||||
#undef BDR_ONLY
|
||||
|
||||
|
||||
2
configure
vendored
2
configure
vendored
@@ -1841,7 +1841,7 @@ if test "$major_version_num" -lt '10'; then
|
||||
version_num_int=$(echo "$version_num"|
|
||||
$SED -e 's/^\([0-9]*\)\.\([0-9]*\)$/\1\2/')
|
||||
|
||||
if test "$version_num_int" -lt '94'; then
|
||||
if test "$version_num_int" -lt '93'; then
|
||||
as_fn_error $? "repmgr is not compatible with detected PostgreSQL version: $version_num" "$LINENO" 5
|
||||
fi
|
||||
else
|
||||
|
||||
@@ -38,7 +38,7 @@ if test "$major_version_num" -lt '10'; then
|
||||
version_num_int=$(echo "$version_num"|
|
||||
$SED -e 's/^\([[0-9]]*\)\.\([[0-9]]*\)$/\1\2/')
|
||||
|
||||
if test "$version_num_int" -lt '94'; then
|
||||
if test "$version_num_int" -lt '93'; then
|
||||
AC_MSG_ERROR([repmgr is not compatible with detected PostgreSQL version: $version_num])
|
||||
fi
|
||||
else
|
||||
|
||||
@@ -23,6 +23,16 @@ CREATE TABLE repmgr.events (
|
||||
details TEXT NULL
|
||||
);
|
||||
|
||||
DO $repmgr$
|
||||
DECLARE
|
||||
DECLARE server_version_num INT;
|
||||
BEGIN
|
||||
SELECT setting
|
||||
FROM pg_catalog.pg_settings
|
||||
WHERE name = 'server_version_num'
|
||||
INTO server_version_num;
|
||||
IF server_version_num >= 90400 THEN
|
||||
EXECUTE $repmgr_func$
|
||||
CREATE TABLE repmgr.monitoring_history (
|
||||
primary_node_id INTEGER NOT NULL,
|
||||
standby_node_id INTEGER NOT NULL,
|
||||
@@ -32,7 +42,26 @@ CREATE TABLE repmgr.monitoring_history (
|
||||
last_wal_standby_location PG_LSN,
|
||||
replication_lag BIGINT NOT NULL,
|
||||
apply_lag BIGINT NOT NULL
|
||||
);
|
||||
)
|
||||
$repmgr_func$;
|
||||
ELSE
|
||||
EXECUTE $repmgr_func$
|
||||
CREATE TABLE repmgr.monitoring_history (
|
||||
primary_node_id INTEGER NOT NULL,
|
||||
standby_node_id INTEGER NOT NULL,
|
||||
last_monitor_time TIMESTAMP WITH TIME ZONE NOT NULL,
|
||||
last_apply_time TIMESTAMP WITH TIME ZONE,
|
||||
last_wal_primary_location TEXT NOT NULL,
|
||||
last_wal_standby_location TEXT,
|
||||
replication_lag BIGINT NOT NULL,
|
||||
apply_lag BIGINT NOT NULL
|
||||
)
|
||||
$repmgr_func$;
|
||||
END IF;
|
||||
END$repmgr$;
|
||||
|
||||
|
||||
|
||||
CREATE INDEX idx_monitoring_history_time
|
||||
ON repmgr.monitoring_history (last_monitor_time, standby_node_id);
|
||||
|
||||
@@ -73,10 +102,33 @@ CREATE FUNCTION standby_get_last_updated()
|
||||
|
||||
/* failover functions */
|
||||
|
||||
|
||||
DO $repmgr$
|
||||
DECLARE
|
||||
DECLARE server_version_num INT;
|
||||
BEGIN
|
||||
SELECT setting
|
||||
FROM pg_catalog.pg_settings
|
||||
WHERE name = 'server_version_num'
|
||||
INTO server_version_num;
|
||||
|
||||
IF server_version_num >= 90400 THEN
|
||||
EXECUTE $repmgr_func$
|
||||
CREATE FUNCTION request_vote(INT,INT)
|
||||
RETURNS pg_lsn
|
||||
AS 'MODULE_PATHNAME', 'request_vote'
|
||||
LANGUAGE C STRICT;
|
||||
$repmgr_func$;
|
||||
ELSE
|
||||
EXECUTE $repmgr_func$
|
||||
CREATE FUNCTION request_vote(INT,INT)
|
||||
RETURNS TEXT
|
||||
AS 'MODULE_PATHNAME', 'request_vote'
|
||||
LANGUAGE C STRICT;
|
||||
$repmgr_func$;
|
||||
END IF;
|
||||
END$repmgr$;
|
||||
|
||||
|
||||
CREATE FUNCTION get_voting_status()
|
||||
RETURNS INT
|
||||
|
||||
7
repmgr.c
7
repmgr.c
@@ -20,6 +20,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "postgres.h"
|
||||
#include "fmgr.h"
|
||||
#include "access/xlog.h"
|
||||
@@ -31,7 +32,13 @@
|
||||
#include "storage/shmem.h"
|
||||
#include "storage/spin.h"
|
||||
#include "utils/builtins.h"
|
||||
|
||||
#if (PG_VERSION_NUM >= 90400)
|
||||
#include "utils/pg_lsn.h"
|
||||
#else
|
||||
#include "compat-lsn.h"
|
||||
#endif
|
||||
|
||||
#include "utils/timestamp.h"
|
||||
|
||||
#include "executor/spi.h"
|
||||
|
||||
6
repmgr.h
6
repmgr.h
@@ -26,6 +26,8 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <libpq-fe.h>
|
||||
#include <postgres_fe.h>
|
||||
@@ -39,8 +41,8 @@
|
||||
#include "dbutils.h"
|
||||
#include "log.h"
|
||||
|
||||
#define MIN_SUPPORTED_VERSION "9.4"
|
||||
#define MIN_SUPPORTED_VERSION_NUM 90400
|
||||
#define MIN_SUPPORTED_VERSION "9.3"
|
||||
#define MIN_SUPPORTED_VERSION_NUM 90300
|
||||
|
||||
#define REPLICATION_TYPE_PHYSICAL 1
|
||||
#define REPLICATION_TYPE_BDR 2
|
||||
|
||||
Reference in New Issue
Block a user