"standby follow": verify status of follow target

This commit adds infrastruture for repmgr to be able to check
whether one standby can attach to another node, regardless whether
it is a standby or a primary.

This is intended to prevent a node from attempting to follow a
node whose timeline has diverged. The --dry-run option makes
it possible to test a follow operation before it is carried out.

As a useful side-effect this makes it possible for a standby to
follow another standby.

This is an initial implementation; documentation and possibly
further changes to follow.
This commit is contained in:
Ian Barwick
2018-11-29 17:14:38 +09:00
parent c53782cda3
commit 9e90fcd584
5 changed files with 355 additions and 97 deletions

View File

@@ -2301,7 +2301,14 @@ do_node_rejoin(void)
initPQExpBuffer(&follow_output);
/*
* do_standby_follow_internal() can handle situations where the follow
* target is not the primary, so requires database handles to both
* (even if they point to the same node). For the time being,
* "node rejoin" will only attatch a standby to the primary.
*/
success = do_standby_follow_internal(upstream_conn,
upstream_conn,
&primary_node_record,
&follow_output,
&follow_error_code);