If standby_disconnect_on_failover is set to true in
repmgr.conf, in a failover situation repmgrd will forcibly disconnect
the local node's WAL receiver before making a failover decision.
standby_disconnect_on_failover is available from PostgreSQL 9.5 and later.
Additionally this requires that the repmgr database user is a superuser.
By doing this, it's possible to ensure that, at the point the failover decision is made, no nodes are receiving data from the primary and their LSN location will be static.
standby_disconnect_on_failover must be set to the same value on
all nodes.
Note that when using standby_disconnect_on_failover there will be a delay of 5 seconds
plus however many seconds it takes to confirm the WAL receiver is disconnected before
repmgrd proceeds with the failover decision.
Following the failover operation, no matter what the outcome, each node will reconnect its WAL receiver.
If using standby_disconnect_on_failover, we recommend that the
primary_visibility_consensus option is also used.