From e2a362a171a4fee77232cd2335420df7eff71d90 Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Mon, 3 Feb 2020 17:03:20 +0900 Subject: [PATCH] "node rejoin": check for available replication slots on the rejoin target "standby follow" did this already, but "node rejoin" didn't. --- HISTORY | 1 + doc/appendix-release-notes.xml | 8 ++++++++ repmgr-action-node.c | 15 +++++++++++++++ 3 files changed, 24 insertions(+) diff --git a/HISTORY b/HISTORY index ac7b2da9..ed5168a6 100644 --- a/HISTORY +++ b/HISTORY @@ -7,6 +7,7 @@ during "standby clone" (Ian) repmgr: report error code on follow/rejoin failure due to non-available replication slot (Ian) + repmgr: ensure "node rejoin" checks for available replication slots (Ian) 5.0 2019-10-15 general: add PostgreSQL 12 support (Ian) diff --git a/doc/appendix-release-notes.xml b/doc/appendix-release-notes.xml index 883c4b89..56da4a38 100644 --- a/doc/appendix-release-notes.xml +++ b/doc/appendix-release-notes.xml @@ -48,6 +48,14 @@ Bug fixes + + + + Ensure repmgr node rejoin + checks for available replication slots on the rejoin target. + + + diff --git a/repmgr-action-node.c b/repmgr-action-node.c index ad497d52..b93aa2a2 100644 --- a/repmgr-action-node.c +++ b/repmgr-action-node.c @@ -2228,6 +2228,21 @@ do_node_rejoin(void) exit(ERR_BAD_CONFIG); } + /* + * Sanity-check replication slot availability + */ + if (config_file_options.use_replication_slots) + { + bool slots_available = check_replication_slots_available(primary_node_record.node_id, + primary_conn); + if (slots_available == false) + { + PQfinish(primary_conn); + exit(ERR_BAD_CONFIG); + } + } + + /* * sanity-check that it will actually be possible to stream from the new upstream */