mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-23 07:06:30 +00:00
Compare commits
7 Commits
dev/gianni
...
v5.2.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0fb3432398 | ||
|
|
5e59e543d6 | ||
|
|
4f6b642320 | ||
|
|
c1973438f7 | ||
|
|
fe5904e04e | ||
|
|
2cb1f4f728 | ||
|
|
5b90842c55 |
2
HISTORY
2
HISTORY
@@ -1,4 +1,4 @@
|
|||||||
5.2.0 2020-??-??
|
5.2.0 2020-10-22
|
||||||
general: add support for PostgreSQL 13 (Ian)
|
general: add support for PostgreSQL 13 (Ian)
|
||||||
general: remove support for PostgreSQL 9.3 (Ian)
|
general: remove support for PostgreSQL 9.3 (Ian)
|
||||||
config: add support for file inclusion directives (Ian)
|
config: add support for file inclusion directives (Ian)
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ EXTENSION = repmgr
|
|||||||
DATA = \
|
DATA = \
|
||||||
repmgr--unpackaged--4.0.sql \
|
repmgr--unpackaged--4.0.sql \
|
||||||
repmgr--unpackaged--5.1.sql \
|
repmgr--unpackaged--5.1.sql \
|
||||||
|
repmgr--unpackaged--5.2.sql \
|
||||||
repmgr--4.0.sql \
|
repmgr--4.0.sql \
|
||||||
repmgr--4.0--4.1.sql \
|
repmgr--4.0--4.1.sql \
|
||||||
repmgr--4.1.sql \
|
repmgr--4.1.sql \
|
||||||
|
|||||||
20
configure
vendored
20
configure
vendored
@@ -1,6 +1,6 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Guess values for system-dependent variables and create Makefiles.
|
# Guess values for system-dependent variables and create Makefiles.
|
||||||
# Generated by GNU Autoconf 2.69 for repmgr 5.2.
|
# Generated by GNU Autoconf 2.69 for repmgr 5.2.0.
|
||||||
#
|
#
|
||||||
# Report bugs to <repmgr@googlegroups.com>.
|
# Report bugs to <repmgr@googlegroups.com>.
|
||||||
#
|
#
|
||||||
@@ -582,8 +582,8 @@ MAKEFLAGS=
|
|||||||
# Identity of this package.
|
# Identity of this package.
|
||||||
PACKAGE_NAME='repmgr'
|
PACKAGE_NAME='repmgr'
|
||||||
PACKAGE_TARNAME='repmgr'
|
PACKAGE_TARNAME='repmgr'
|
||||||
PACKAGE_VERSION='5.2'
|
PACKAGE_VERSION='5.2.0'
|
||||||
PACKAGE_STRING='repmgr 5.2'
|
PACKAGE_STRING='repmgr 5.2.0'
|
||||||
PACKAGE_BUGREPORT='repmgr@googlegroups.com'
|
PACKAGE_BUGREPORT='repmgr@googlegroups.com'
|
||||||
PACKAGE_URL='https://repmgr.org/'
|
PACKAGE_URL='https://repmgr.org/'
|
||||||
|
|
||||||
@@ -1181,7 +1181,7 @@ if test "$ac_init_help" = "long"; then
|
|||||||
# Omit some internal or obsolete options to make the list less imposing.
|
# Omit some internal or obsolete options to make the list less imposing.
|
||||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||||
cat <<_ACEOF
|
cat <<_ACEOF
|
||||||
\`configure' configures repmgr 5.2 to adapt to many kinds of systems.
|
\`configure' configures repmgr 5.2.0 to adapt to many kinds of systems.
|
||||||
|
|
||||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||||
|
|
||||||
@@ -1242,7 +1242,7 @@ fi
|
|||||||
|
|
||||||
if test -n "$ac_init_help"; then
|
if test -n "$ac_init_help"; then
|
||||||
case $ac_init_help in
|
case $ac_init_help in
|
||||||
short | recursive ) echo "Configuration of repmgr 5.2:";;
|
short | recursive ) echo "Configuration of repmgr 5.2.0:";;
|
||||||
esac
|
esac
|
||||||
cat <<\_ACEOF
|
cat <<\_ACEOF
|
||||||
|
|
||||||
@@ -1316,7 +1316,7 @@ fi
|
|||||||
test -n "$ac_init_help" && exit $ac_status
|
test -n "$ac_init_help" && exit $ac_status
|
||||||
if $ac_init_version; then
|
if $ac_init_version; then
|
||||||
cat <<\_ACEOF
|
cat <<\_ACEOF
|
||||||
repmgr configure 5.2
|
repmgr configure 5.2.0
|
||||||
generated by GNU Autoconf 2.69
|
generated by GNU Autoconf 2.69
|
||||||
|
|
||||||
Copyright (C) 2012 Free Software Foundation, Inc.
|
Copyright (C) 2012 Free Software Foundation, Inc.
|
||||||
@@ -1335,7 +1335,7 @@ cat >config.log <<_ACEOF
|
|||||||
This file contains any messages produced by compilers while
|
This file contains any messages produced by compilers while
|
||||||
running configure, to aid debugging if configure makes a mistake.
|
running configure, to aid debugging if configure makes a mistake.
|
||||||
|
|
||||||
It was created by repmgr $as_me 5.2, which was
|
It was created by repmgr $as_me 5.2.0, which was
|
||||||
generated by GNU Autoconf 2.69. Invocation command line was
|
generated by GNU Autoconf 2.69. Invocation command line was
|
||||||
|
|
||||||
$ $0 $@
|
$ $0 $@
|
||||||
@@ -1824,7 +1824,7 @@ if test "$major_version_num" -lt '10'; then
|
|||||||
version_num_int=$(echo "$version_num"|
|
version_num_int=$(echo "$version_num"|
|
||||||
$SED -e 's/^\([0-9]*\)\.\([0-9]*\)$/\1\2/')
|
$SED -e 's/^\([0-9]*\)\.\([0-9]*\)$/\1\2/')
|
||||||
|
|
||||||
if test "$version_num_int" -lt '93'; then
|
if test "$version_num_int" -lt '94'; then
|
||||||
as_fn_error $? "repmgr is not compatible with detected PostgreSQL version: $version_num" "$LINENO" 5
|
as_fn_error $? "repmgr is not compatible with detected PostgreSQL version: $version_num" "$LINENO" 5
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
@@ -2487,7 +2487,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
|
|||||||
# report actual input values of CONFIG_FILES etc. instead of their
|
# report actual input values of CONFIG_FILES etc. instead of their
|
||||||
# values after options handling.
|
# values after options handling.
|
||||||
ac_log="
|
ac_log="
|
||||||
This file was extended by repmgr $as_me 5.2, which was
|
This file was extended by repmgr $as_me 5.2.0, which was
|
||||||
generated by GNU Autoconf 2.69. Invocation command line was
|
generated by GNU Autoconf 2.69. Invocation command line was
|
||||||
|
|
||||||
CONFIG_FILES = $CONFIG_FILES
|
CONFIG_FILES = $CONFIG_FILES
|
||||||
@@ -2550,7 +2550,7 @@ _ACEOF
|
|||||||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||||
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
|
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
|
||||||
ac_cs_version="\\
|
ac_cs_version="\\
|
||||||
repmgr config.status 5.2
|
repmgr config.status 5.2.0
|
||||||
configured by $0, generated by GNU Autoconf 2.69,
|
configured by $0, generated by GNU Autoconf 2.69,
|
||||||
with options \\"\$ac_cs_config\\"
|
with options \\"\$ac_cs_config\\"
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
AC_INIT([repmgr], [5.2], [repmgr@googlegroups.com], [repmgr], [https://repmgr.org/])
|
AC_INIT([repmgr], [5.2.0], [repmgr@googlegroups.com], [repmgr], [https://repmgr.org/])
|
||||||
|
|
||||||
AC_COPYRIGHT([Copyright (c) 2010-2020, 2ndQuadrant Ltd.])
|
AC_COPYRIGHT([Copyright (c) 2010-2020, 2ndQuadrant Ltd.])
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ if test "$major_version_num" -lt '10'; then
|
|||||||
version_num_int=$(echo "$version_num"|
|
version_num_int=$(echo "$version_num"|
|
||||||
$SED -e 's/^\([[0-9]]*\)\.\([[0-9]]*\)$/\1\2/')
|
$SED -e 's/^\([[0-9]]*\)\.\([[0-9]]*\)$/\1\2/')
|
||||||
|
|
||||||
if test "$version_num_int" -lt '93'; then
|
if test "$version_num_int" -lt '94'; then
|
||||||
AC_MSG_ERROR([repmgr is not compatible with detected PostgreSQL version: $version_num])
|
AC_MSG_ERROR([repmgr is not compatible with detected PostgreSQL version: $version_num])
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -18,14 +18,14 @@
|
|||||||
<!-- remember to update the release date in ../repmgr_version.h.in -->
|
<!-- remember to update the release date in ../repmgr_version.h.in -->
|
||||||
|
|
||||||
<sect1 id="release-5.2.0">
|
<sect1 id="release-5.2.0">
|
||||||
<title>Release 5.2.0</title>
|
<title id="release-current">Release 5.2.0</title>
|
||||||
<para><emphasis>??? ?? ???, 2020</emphasis></para>
|
<para><emphasis>Thu 22 October, 2020</emphasis></para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
&repmgr; 5.2.0 is a major release.
|
&repmgr; 5.2.0 is a major release.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
This release provides support for <ulink url="https://www.postgresql.org/docs/13/release-13.htmll">PostgreSQL 13</ulink>, released in September 2020.
|
This release provides support for <ulink url="https://www.postgresql.org/docs/13/release-13.html">PostgreSQL 13</ulink>, released in September 2020.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
This release removes support for PostgreSQL 9.3, which was
|
This release removes support for PostgreSQL 9.3, which was
|
||||||
@@ -220,7 +220,7 @@
|
|||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
<sect1 id="release-5.1.0">
|
<sect1 id="release-5.1.0">
|
||||||
<title id="release-current">Release 5.1.0</title>
|
<title>Release 5.1.0</title>
|
||||||
<para><emphasis>Mon 13 April, 2020</emphasis></para>
|
<para><emphasis>Mon 13 April, 2020</emphasis></para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
|
|||||||
@@ -133,10 +133,10 @@
|
|||||||
&repmgr; 5.1
|
&repmgr; 5.1
|
||||||
</entry>
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
YES
|
NO
|
||||||
</entry>
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
<link linkend="release-5.1.0">5.1</link> (2020-04-13)
|
<link linkend="release-5.1.0">5.1.0</link> (2020-04-13)
|
||||||
</entry>
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
9.3, 9.4, 9.5, 9.6, 10, 11, 12
|
9.3, 9.4, 9.5, 9.6, 10, 11, 12
|
||||||
|
|||||||
@@ -532,7 +532,7 @@ ALTER EXTENSION repmgr UPDATE</programlisting>
|
|||||||
<sect2>
|
<sect2>
|
||||||
<title>Upgrading the repmgr schema (PostgreSQL 13 and later)</title>
|
<title>Upgrading the repmgr schema (PostgreSQL 13 and later)</title>
|
||||||
<para>
|
<para>
|
||||||
Beginning with PostgreSQL 13, the <command>CREATE EXTENSION ... FROM</command>
|
Beginning with PostgreSQL 13, the <command>CREATE EXTENSION ... FROM unpackaged</command>
|
||||||
syntax is no longer available. In the unlikely event you have ended up with an
|
syntax is no longer available. In the unlikely event you have ended up with an
|
||||||
installation running PostgreSQL 13 or later and containing the legacy &repmgr;
|
installation running PostgreSQL 13 or later and containing the legacy &repmgr;
|
||||||
schema, there is no convenient way of upgrading this; instead you'll just need
|
schema, there is no convenient way of upgrading this; instead you'll just need
|
||||||
|
|||||||
245
repmgr--unpackaged--5.2.sql
Normal file
245
repmgr--unpackaged--5.2.sql
Normal file
@@ -0,0 +1,245 @@
|
|||||||
|
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
|
||||||
|
\echo Use "CREATE EXTENSION repmgr" to load this file. \quit
|
||||||
|
|
||||||
|
-- extract the current schema name
|
||||||
|
-- NOTE: this assumes there will be only one schema matching 'repmgr_%';
|
||||||
|
-- user is responsible for ensuring this is the case
|
||||||
|
|
||||||
|
CREATE TEMPORARY TABLE repmgr_old_schema (schema_name TEXT);
|
||||||
|
INSERT INTO repmgr_old_schema (schema_name)
|
||||||
|
SELECT nspname AS schema_name
|
||||||
|
FROM pg_catalog.pg_namespace
|
||||||
|
WHERE nspname LIKE 'repmgr_%'
|
||||||
|
LIMIT 1;
|
||||||
|
|
||||||
|
-- move old objects into new schema
|
||||||
|
DO $repmgr$
|
||||||
|
DECLARE
|
||||||
|
old_schema TEXT;
|
||||||
|
BEGIN
|
||||||
|
SELECT schema_name FROM repmgr_old_schema
|
||||||
|
INTO old_schema;
|
||||||
|
EXECUTE format('ALTER TABLE %I.repl_nodes SET SCHEMA repmgr', old_schema);
|
||||||
|
EXECUTE format('ALTER TABLE %I.repl_events SET SCHEMA repmgr', old_schema);
|
||||||
|
EXECUTE format('ALTER TABLE %I.repl_monitor SET SCHEMA repmgr', old_schema);
|
||||||
|
EXECUTE format('DROP VIEW IF EXISTS %I.repl_show_nodes', old_schema);
|
||||||
|
EXECUTE format('DROP VIEW IF EXISTS %I.repl_status', old_schema);
|
||||||
|
END$repmgr$;
|
||||||
|
|
||||||
|
-- convert "repmgr_$cluster.repl_nodes" to "repmgr.nodes"
|
||||||
|
CREATE TABLE repmgr.nodes (
|
||||||
|
node_id INTEGER PRIMARY KEY,
|
||||||
|
upstream_node_id INTEGER NULL REFERENCES repmgr.nodes (node_id) DEFERRABLE,
|
||||||
|
active BOOLEAN NOT NULL DEFAULT TRUE,
|
||||||
|
node_name TEXT NOT NULL,
|
||||||
|
type TEXT NOT NULL CHECK (type IN('primary','standby','witness','bdr')),
|
||||||
|
location TEXT NOT NULL DEFAULT 'default',
|
||||||
|
priority INT NOT NULL DEFAULT 100,
|
||||||
|
conninfo TEXT NOT NULL,
|
||||||
|
repluser VARCHAR(63) NOT NULL,
|
||||||
|
slot_name TEXT NULL,
|
||||||
|
config_file TEXT NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO repmgr.nodes
|
||||||
|
(node_id, upstream_node_id, active, node_name, type, location, priority, conninfo, repluser, slot_name, config_file)
|
||||||
|
SELECT id, upstream_node_id, active, name,
|
||||||
|
CASE WHEN type = 'master' THEN 'primary' ELSE type END,
|
||||||
|
'default', priority, conninfo, 'unknown', slot_name, 'unknown'
|
||||||
|
FROM repmgr.repl_nodes
|
||||||
|
ORDER BY id;
|
||||||
|
|
||||||
|
|
||||||
|
-- convert "repmgr_$cluster.repl_event" to "event"
|
||||||
|
|
||||||
|
CREATE TABLE repmgr.events (
|
||||||
|
node_id INTEGER NOT NULL,
|
||||||
|
event TEXT NOT NULL,
|
||||||
|
successful BOOLEAN NOT NULL DEFAULT TRUE,
|
||||||
|
event_timestamp TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
details TEXT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO repmgr.events
|
||||||
|
(node_id, event, successful, event_timestamp, details)
|
||||||
|
SELECT node_id, event, successful, event_timestamp, details
|
||||||
|
FROM repmgr.repl_events;
|
||||||
|
|
||||||
|
-- create new table "repmgr.voting_term"
|
||||||
|
CREATE TABLE repmgr.voting_term (
|
||||||
|
term INT NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE UNIQUE INDEX voting_term_restrict
|
||||||
|
ON repmgr.voting_term ((TRUE));
|
||||||
|
|
||||||
|
CREATE RULE voting_term_delete AS
|
||||||
|
ON DELETE TO repmgr.voting_term
|
||||||
|
DO INSTEAD NOTHING;
|
||||||
|
|
||||||
|
INSERT INTO repmgr.voting_term (term) VALUES (1);
|
||||||
|
|
||||||
|
-- convert "repmgr_$cluster.repl_monitor" to "monitoring_history"
|
||||||
|
|
||||||
|
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 PG_LSN NOT NULL,
|
||||||
|
last_wal_standby_location PG_LSN,
|
||||||
|
replication_lag BIGINT NOT NULL,
|
||||||
|
apply_lag BIGINT NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO repmgr.monitoring_history
|
||||||
|
(primary_node_id, standby_node_id, last_monitor_time, last_apply_time, last_wal_primary_location, last_wal_standby_location, replication_lag, apply_lag)
|
||||||
|
SELECT primary_node, standby_node, last_monitor_time, last_apply_time, last_wal_primary_location::pg_lsn, last_wal_standby_location::pg_lsn, replication_lag, apply_lag
|
||||||
|
FROM repmgr.repl_monitor;
|
||||||
|
|
||||||
|
CREATE INDEX idx_monitoring_history_time
|
||||||
|
ON repmgr.monitoring_history (last_monitor_time, standby_node_id);
|
||||||
|
|
||||||
|
CREATE VIEW repmgr.show_nodes AS
|
||||||
|
SELECT n.node_id,
|
||||||
|
n.node_name,
|
||||||
|
n.active,
|
||||||
|
n.upstream_node_id,
|
||||||
|
un.node_name AS upstream_node_name,
|
||||||
|
n.type,
|
||||||
|
n.priority,
|
||||||
|
n.conninfo
|
||||||
|
FROM repmgr.nodes n
|
||||||
|
LEFT JOIN repmgr.nodes un
|
||||||
|
ON un.node_id = n.upstream_node_id;
|
||||||
|
|
||||||
|
|
||||||
|
/* ================= */
|
||||||
|
/* repmgrd functions */
|
||||||
|
/* ================= */
|
||||||
|
|
||||||
|
/* monitoring functions */
|
||||||
|
|
||||||
|
CREATE FUNCTION set_local_node_id(INT)
|
||||||
|
RETURNS VOID
|
||||||
|
AS 'MODULE_PATHNAME', 'set_local_node_id'
|
||||||
|
LANGUAGE C STRICT;
|
||||||
|
|
||||||
|
CREATE FUNCTION get_local_node_id()
|
||||||
|
RETURNS INT
|
||||||
|
AS 'MODULE_PATHNAME', 'get_local_node_id'
|
||||||
|
LANGUAGE C STRICT;
|
||||||
|
|
||||||
|
CREATE FUNCTION standby_set_last_updated()
|
||||||
|
RETURNS TIMESTAMP WITH TIME ZONE
|
||||||
|
AS 'MODULE_PATHNAME', 'standby_set_last_updated'
|
||||||
|
LANGUAGE C STRICT;
|
||||||
|
|
||||||
|
CREATE FUNCTION standby_get_last_updated()
|
||||||
|
RETURNS TIMESTAMP WITH TIME ZONE
|
||||||
|
AS 'MODULE_PATHNAME', 'standby_get_last_updated'
|
||||||
|
LANGUAGE C STRICT;
|
||||||
|
|
||||||
|
CREATE FUNCTION set_upstream_last_seen(INT)
|
||||||
|
RETURNS VOID
|
||||||
|
AS 'MODULE_PATHNAME', 'set_upstream_last_seen'
|
||||||
|
LANGUAGE C STRICT;
|
||||||
|
|
||||||
|
CREATE FUNCTION get_upstream_last_seen()
|
||||||
|
RETURNS INT
|
||||||
|
AS 'MODULE_PATHNAME', 'get_upstream_last_seen'
|
||||||
|
LANGUAGE C STRICT;
|
||||||
|
|
||||||
|
CREATE FUNCTION get_upstream_node_id()
|
||||||
|
RETURNS INT
|
||||||
|
AS 'MODULE_PATHNAME', 'get_upstream_node_id'
|
||||||
|
LANGUAGE C STRICT;
|
||||||
|
|
||||||
|
CREATE FUNCTION set_upstream_node_id(INT)
|
||||||
|
RETURNS VOID
|
||||||
|
AS 'MODULE_PATHNAME', 'set_upstream_node_id'
|
||||||
|
LANGUAGE C STRICT;
|
||||||
|
|
||||||
|
/* failover functions */
|
||||||
|
|
||||||
|
CREATE FUNCTION notify_follow_primary(INT)
|
||||||
|
RETURNS VOID
|
||||||
|
AS 'MODULE_PATHNAME', 'notify_follow_primary'
|
||||||
|
LANGUAGE C STRICT;
|
||||||
|
|
||||||
|
CREATE FUNCTION get_new_primary()
|
||||||
|
RETURNS INT
|
||||||
|
AS 'MODULE_PATHNAME', 'get_new_primary'
|
||||||
|
LANGUAGE C STRICT;
|
||||||
|
|
||||||
|
CREATE FUNCTION reset_voting_status()
|
||||||
|
RETURNS VOID
|
||||||
|
AS 'MODULE_PATHNAME', 'reset_voting_status'
|
||||||
|
LANGUAGE C STRICT;
|
||||||
|
|
||||||
|
CREATE FUNCTION get_repmgrd_pid()
|
||||||
|
RETURNS INT
|
||||||
|
AS 'MODULE_PATHNAME', 'get_repmgrd_pid'
|
||||||
|
LANGUAGE C STRICT;
|
||||||
|
|
||||||
|
CREATE FUNCTION get_repmgrd_pidfile()
|
||||||
|
RETURNS TEXT
|
||||||
|
AS 'MODULE_PATHNAME', 'get_repmgrd_pidfile'
|
||||||
|
LANGUAGE C STRICT;
|
||||||
|
|
||||||
|
CREATE FUNCTION set_repmgrd_pid(INT, TEXT)
|
||||||
|
RETURNS VOID
|
||||||
|
AS 'MODULE_PATHNAME', 'set_repmgrd_pid'
|
||||||
|
LANGUAGE C CALLED ON NULL INPUT;
|
||||||
|
|
||||||
|
CREATE FUNCTION repmgrd_is_running()
|
||||||
|
RETURNS BOOL
|
||||||
|
AS 'MODULE_PATHNAME', 'repmgrd_is_running'
|
||||||
|
LANGUAGE C STRICT;
|
||||||
|
|
||||||
|
CREATE FUNCTION repmgrd_pause(BOOL)
|
||||||
|
RETURNS VOID
|
||||||
|
AS 'MODULE_PATHNAME', 'repmgrd_pause'
|
||||||
|
LANGUAGE C STRICT;
|
||||||
|
|
||||||
|
CREATE FUNCTION repmgrd_is_paused()
|
||||||
|
RETURNS BOOL
|
||||||
|
AS 'MODULE_PATHNAME', 'repmgrd_is_paused'
|
||||||
|
LANGUAGE C STRICT;
|
||||||
|
|
||||||
|
CREATE FUNCTION get_wal_receiver_pid()
|
||||||
|
RETURNS INT
|
||||||
|
AS 'MODULE_PATHNAME', 'get_wal_receiver_pid'
|
||||||
|
LANGUAGE C STRICT;
|
||||||
|
|
||||||
|
|
||||||
|
/* views */
|
||||||
|
|
||||||
|
CREATE VIEW repmgr.replication_status AS
|
||||||
|
SELECT m.primary_node_id, m.standby_node_id, n.node_name AS standby_name,
|
||||||
|
n.type AS node_type, n.active, last_monitor_time,
|
||||||
|
CASE WHEN n.type='standby' THEN m.last_wal_primary_location ELSE NULL END AS last_wal_primary_location,
|
||||||
|
m.last_wal_standby_location,
|
||||||
|
CASE WHEN n.type='standby' THEN pg_catalog.pg_size_pretty(m.replication_lag) ELSE NULL END AS replication_lag,
|
||||||
|
CASE WHEN n.type='standby' THEN
|
||||||
|
CASE WHEN replication_lag > 0 THEN age(now(), m.last_apply_time) ELSE '0'::INTERVAL END
|
||||||
|
ELSE NULL
|
||||||
|
END AS replication_time_lag,
|
||||||
|
CASE WHEN n.type='standby' THEN pg_catalog.pg_size_pretty(m.apply_lag) ELSE NULL END AS apply_lag,
|
||||||
|
AGE(NOW(), CASE WHEN pg_catalog.pg_is_in_recovery() THEN repmgr.standby_get_last_updated() ELSE m.last_monitor_time END) AS communication_time_lag
|
||||||
|
FROM repmgr.monitoring_history m
|
||||||
|
JOIN repmgr.nodes n ON m.standby_node_id = n.node_id
|
||||||
|
WHERE (m.standby_node_id, m.last_monitor_time) IN (
|
||||||
|
SELECT m1.standby_node_id, MAX(m1.last_monitor_time)
|
||||||
|
FROM repmgr.monitoring_history m1 GROUP BY 1
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* drop old tables */
|
||||||
|
DROP TABLE repmgr.repl_nodes;
|
||||||
|
DROP TABLE repmgr.repl_monitor;
|
||||||
|
DROP TABLE repmgr.repl_events;
|
||||||
|
|
||||||
|
-- remove temporary table
|
||||||
|
DROP TABLE repmgr_old_schema;
|
||||||
@@ -5962,19 +5962,22 @@ check_source_server_via_barman()
|
|||||||
|
|
||||||
initPQExpBuffer(&command_output);
|
initPQExpBuffer(&command_output);
|
||||||
maxlen_snprintf(buf,
|
maxlen_snprintf(buf,
|
||||||
"ssh %s \"psql -Aqt \\\"%s\\\" -c \\\""
|
"psql -AqtX -d \\\"%s\\\" -c \\\""
|
||||||
" SELECT conninfo"
|
" SELECT conninfo"
|
||||||
" FROM repmgr.nodes"
|
" FROM repmgr.nodes"
|
||||||
" WHERE %s"
|
" WHERE %s"
|
||||||
" AND active IS TRUE"
|
" AND active IS TRUE"
|
||||||
"\\\"\"",
|
"\\\"",
|
||||||
config_file_options.barman_host,
|
|
||||||
repmgr_conninfo_buf.data,
|
repmgr_conninfo_buf.data,
|
||||||
where_condition);
|
where_condition);
|
||||||
|
|
||||||
termPQExpBuffer(&repmgr_conninfo_buf);
|
termPQExpBuffer(&repmgr_conninfo_buf);
|
||||||
|
|
||||||
command_success = local_command(buf, &command_output);
|
command_success = remote_command(config_file_options.barman_host,
|
||||||
|
runtime_options.remote_user,
|
||||||
|
buf,
|
||||||
|
config_file_options.ssh_options,
|
||||||
|
&command_output);
|
||||||
|
|
||||||
if (command_success == false)
|
if (command_success == false)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#define REPMGR_VERSION_DATE ""
|
#define REPMGR_VERSION_DATE ""
|
||||||
#define REPMGR_VERSION "5.2dev"
|
#define REPMGR_VERSION "5.2.0"
|
||||||
#define REPMGR_VERSION_NUM 50200
|
#define REPMGR_VERSION_NUM 50200
|
||||||
#define REPMGR_RELEASE_DATE "2020-XX-XX"
|
#define REPMGR_RELEASE_DATE "2020-10-22"
|
||||||
#define PG_ACTUAL_VERSION_NUM
|
#define PG_ACTUAL_VERSION_NUM
|
||||||
|
|||||||
Reference in New Issue
Block a user