master register: warn if "upstream_node_id" set

This commit is contained in:
Ian Barwick
2017-04-26 22:18:40 +09:00
parent 16a47f5693
commit a3a4c441b6
2 changed files with 16 additions and 2 deletions

View File

@@ -846,6 +846,14 @@ do_master_register(void)
node_info.node_id = config_file_options.node_id;
}
/* if upstream_node_id set, warn that it will be ignored */
if (config_file_options.upstream_node_id != NO_UPSTREAM_NODE)
{
log_warning(_("master node %i is configured with \"upstream_node_id\" set to %i"),
node_info.node_id,
config_file_options.upstream_node_id);
log_detail(_("the value set for \"upstream_node_id\" will be ignored"));
}
/* set type to "master", active to "true" and unset upstream_node_id*/
node_info.type = MASTER;
node_info.upstream_node_id = NO_UPSTREAM_NODE;
@@ -857,8 +865,6 @@ do_master_register(void)
strncpy(node_info.slot_name, repmgr_slot_name_ptr, MAXLEN);
node_info.priority = config_file_options.priority;
// XXX if upstream_node_id set, warn that it will be ignored
initPQExpBuffer(&event_description);
if (record_found)
@@ -1209,6 +1215,13 @@ bool create_repmgr_extension(PGconn *conn)
log_notice(_("\"repmgr\" extension successfully installed"));
create_event_record(conn,
&config_file_options,
config_file_options.node_id,
"cluster_created",
true,
NULL);
return true;
}

View File

@@ -4,6 +4,7 @@ cluster=foo
node=1
node_id=1
upstream_node_id=2
node_name='node1'
use_replication_slots = true
conninfo = 'host=127.0.0.1 dbname=repmgr user=repmgr port=5501 connect_timeout=2'