repmgr master register: support --dry-run

This commit is contained in:
Ian Barwick
2017-06-14 09:18:38 +09:00
parent 6af75a1151
commit dd06c82821
2 changed files with 25 additions and 3 deletions

View File

@@ -67,6 +67,18 @@ do_master_register(void)
exit(ERR_BAD_CONFIG);
}
/*
* In --dry-run mode we can't proceed any further as the following code
* attempts to query the repmgr metadata, which won't exist until
* the extension is installed
*/
if (runtime_options.dry_run == true)
{
PQfinish(conn);
return;
}
/* Ensure there isn't another registered node which is master */
master_conn = get_master_connection(conn, &current_master_id, NULL);
@@ -134,6 +146,7 @@ do_master_register(void)
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;