mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-27 17:06:29 +00:00
Cascading replication support for Barman mode
If upstream_node is specified, we point the standby to that node; otherwise we point it to the current primary node.
This commit is contained in:
committed by
Ian Barwick
parent
135fa2e1b9
commit
c0eea90402
15
repmgr.c
15
repmgr.c
@@ -5172,16 +5172,27 @@ create_recovery_file(const char *data_dir, PGconn *primary_conn, const char *con
|
|||||||
if (primary_conn == NULL)
|
if (primary_conn == NULL)
|
||||||
{
|
{
|
||||||
char buf[MAXLEN];
|
char buf[MAXLEN];
|
||||||
|
char where_condition[MAXLEN];
|
||||||
PQExpBufferData command_output;
|
PQExpBufferData command_output;
|
||||||
|
|
||||||
|
switch(options.upstream_node)
|
||||||
|
{
|
||||||
|
case NO_UPSTREAM_NODE:
|
||||||
|
maxlen_snprintf(where_condition, "type='master'");
|
||||||
|
default:
|
||||||
|
maxlen_snprintf(where_condition, "id=%d", options.upstream_node);
|
||||||
|
}
|
||||||
|
|
||||||
initPQExpBuffer(&command_output);
|
initPQExpBuffer(&command_output);
|
||||||
maxlen_snprintf(buf,
|
maxlen_snprintf(buf,
|
||||||
"ssh %s \"psql -Aqt \\\"%s\\\" -c \\\""
|
"ssh %s \"psql -Aqt \\\"%s\\\" -c \\\""
|
||||||
" SELECT conninfo"
|
" SELECT conninfo"
|
||||||
" FROM repmgr_%s.repl_nodes"
|
" FROM repmgr_%s.repl_nodes"
|
||||||
" WHERE type='master'"
|
" WHERE %s"
|
||||||
" AND active"
|
" AND active"
|
||||||
"\\\"\"", options.barman_server, conninfo_on_barman, options.cluster_name);
|
"\\\"\"",
|
||||||
|
options.barman_server, conninfo_on_barman,
|
||||||
|
options.cluster_name, where_condition);
|
||||||
(void)local_command(buf, &command_output);
|
(void)local_command(buf, &command_output);
|
||||||
maxlen_snprintf(buf, "%s", command_output.data);
|
maxlen_snprintf(buf, "%s", command_output.data);
|
||||||
string_remove_trailing_newlines(buf);
|
string_remove_trailing_newlines(buf);
|
||||||
|
|||||||
Reference in New Issue
Block a user