mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-27 17:06:29 +00:00
note that "standby follow" requires a primary to be available
While it's technically possible to have a standby follow another standby while the primary is not available, repmgr will not be able to update its metadata, which will cause Confusion and Chaos. Update the documentation to make this clear, and provide a more helpful error message if this situation occurs. The operation previously failed anyway, but with an unhelpful message about not being able to find a node record.
This commit is contained in:
@@ -2784,12 +2784,6 @@ do_standby_follow(void)
|
||||
|
||||
PQfinish(local_conn);
|
||||
|
||||
if (runtime_options.dry_run == true)
|
||||
{
|
||||
log_info(_("prerequisites for executing STANDBY FOLLOW are met"));
|
||||
exit(SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
* Here we'll need a connection to the primary, if the upstream is not a primary.
|
||||
*/
|
||||
@@ -2802,12 +2796,30 @@ do_standby_follow(void)
|
||||
primary_conn = get_primary_connection_quiet(follow_target_conn,
|
||||
&primary_node_id,
|
||||
NULL);
|
||||
|
||||
/*
|
||||
* If follow target is not primary and no other primary could be found,
|
||||
* abort because we won't be able to update the node record.
|
||||
*/
|
||||
if (PQstatus(primary_conn) != CONNECTION_OK)
|
||||
{
|
||||
log_error(_("unable to determine the cluster primary"));
|
||||
log_detail(_("an active primary node is required for \"repmgr standby follow\""));
|
||||
PQfinish(follow_target_conn);
|
||||
exit(ERR_FOLLOW_FAIL);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
primary_conn = follow_target_conn;
|
||||
}
|
||||
|
||||
if (runtime_options.dry_run == true)
|
||||
{
|
||||
log_info(_("prerequisites for executing STANDBY FOLLOW are met"));
|
||||
exit(SUCCESS);
|
||||
}
|
||||
|
||||
initPQExpBuffer(&follow_output);
|
||||
|
||||
success = do_standby_follow_internal(
|
||||
|
||||
Reference in New Issue
Block a user