From 2249b79811dd4e117c45eb10e8012ec3b7c4a45c Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Tue, 2 Apr 2019 10:45:45 +0900 Subject: [PATCH] standby switchover: list nodes which will remain attatched to the old primary If --siblings-follow is not supplied, list all nodes which repmgr considers to be siblings (this will include the witness server, if in use), and which will remain attached to the old primary. --- doc/repmgr-standby-switchover.sgml | 10 +++++++--- doc/switchover.sgml | 3 ++- repmgr-action-standby.c | 19 ++++++++++++++++++- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/doc/repmgr-standby-switchover.sgml b/doc/repmgr-standby-switchover.sgml index ed5ad0df..5548626a 100644 --- a/doc/repmgr-standby-switchover.sgml +++ b/doc/repmgr-standby-switchover.sgml @@ -22,10 +22,10 @@ passwordless SSH connection to the current primary. - If other standbys are connected to the demotion candidate, &repmgr; can instruct + If other nodes are connected to the demotion candidate, &repmgr; can instruct these to follow the new primary if the option --siblings-follow is specified. This requires a passwordless SSH connection between the promotion - candidate (new primary) and the standbys attached to the demotion candidate + candidate (new primary) and the nodes attached to the demotion candidate (existing primary). @@ -150,7 +150,11 @@ - Have standbys attached to the old primary follow the new primary. + Have nodes attached to the old primary follow the new primary. + + + This will also ensure that a witness node, if in use, is updated + with the new primary's data. diff --git a/doc/switchover.sgml b/doc/switchover.sgml index 894c03db..4c0e71cb 100644 --- a/doc/switchover.sgml +++ b/doc/switchover.sgml @@ -72,7 +72,8 @@ Ensure that a passwordless SSH connection is possible from the promotion candidate (standby) to the demotion candidate (current primary). If --siblings-follow will be used, ensure that passwordless SSH connections are possible from the - promotion candidate to all standbys attached to the demotion candidate. + promotion candidate to all nodes attached to the demotion candidate + (including the witness server, if in use). diff --git a/repmgr-action-standby.c b/repmgr-action-standby.c index a9651b60..9b3a4b2b 100644 --- a/repmgr-action-standby.c +++ b/repmgr-action-standby.c @@ -3561,9 +3561,26 @@ do_standby_switchover(void) { if (sibling_nodes.node_count > 0) { + PQExpBufferData nodes; + NodeInfoListCell *cell; + + initPQExpBuffer(&nodes); + + for (cell = sibling_nodes.head; cell; cell = cell->next) + { + appendPQExpBuffer(&nodes, + " %s (node ID: %i)", + cell->node_info->node_name, + cell->node_info->node_id); + if (cell->next) + appendPQExpBufferStr(&nodes, "\n"); + } + log_warning(_("%i sibling nodes found, but option \"--siblings-follow\" not specified"), sibling_nodes.node_count); - log_detail(_("these nodes will remain attached to the current primary")); + log_detail(_("these nodes will remain attached to the current primary:\n%s"), nodes.data); + + termPQExpBuffer(&nodes); } } else