mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-23 15:16:29 +00:00
Fix "standby clone" in Barman mode with --no-upstream-connection
"--upstream-node-id", if provided, was not being passed through to the SQL query executed via the Barman server. Also modified the query to select the primary node if "--upstream-node-id" is not provided. Note: this is a very niche use case.
This commit is contained in:
@@ -237,6 +237,9 @@ do_standby_clone(void)
|
||||
*/
|
||||
check_source_server();
|
||||
}
|
||||
else {
|
||||
upstream_node_id = runtime_options.upstream_node_id;
|
||||
}
|
||||
|
||||
/*
|
||||
* if --upstream-conninfo was supplied, use that (will overwrite value set
|
||||
@@ -3376,8 +3379,14 @@ check_source_server_via_barman()
|
||||
"repmgr database conninfo string on barman server: %s",
|
||||
repmgr_conninfo_buf.data);
|
||||
|
||||
/* XXX check this works in all cases */
|
||||
maxlen_snprintf(where_condition, "node_id=%i", upstream_node_id);
|
||||
if (upstream_node_id == UNKNOWN_NODE_ID)
|
||||
{
|
||||
maxlen_snprintf(where_condition, "type='primary' AND active IS TRUE");
|
||||
}
|
||||
else
|
||||
{
|
||||
maxlen_snprintf(where_condition, "node_id=%i", upstream_node_id);
|
||||
}
|
||||
|
||||
initPQExpBuffer(&command_output);
|
||||
maxlen_snprintf(buf,
|
||||
|
||||
Reference in New Issue
Block a user