Skip to content

Commit

Permalink
repmgr: prevent involuntary cloning where no repmgr schema present on…
Browse files Browse the repository at this point in the history
… master
  • Loading branch information
ibarwick committed Oct 19, 2016
1 parent 3f7c30b commit 20d66df
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions repmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -2730,6 +2730,27 @@ do_standby_clone(void)
}



/*
* Sanity-check that the master node has a repmgr schema - if not
* present, fail with an error (unless -F/--force is used)
*/

if (check_cluster_schema(primary_conn) == false)
{
if (!runtime_options.force)
{
/* schema doesn't exist */
log_err(_("expected repmgr schema '%s' not found on master server\n"), get_repmgr_schema());
log_hint(_("check that the master server was correctly registered\n"));
PQfinish(source_conn);
exit(ERR_BAD_CONFIG);
}

log_warning(_("expected repmgr schema '%s' not found on master server\n"), get_repmgr_schema());
}


/* Fetch the source's data directory */
if (get_pg_setting(source_conn, "data_directory", master_data_directory) == false)
{
Expand All @@ -2751,6 +2772,8 @@ do_standby_clone(void)
log_hint(_("use -D/--data-dir to explicitly specify a data directory\n"));
}



/*
* Copy the source connection so that we have some default values,
* particularly stuff like passwords extracted from PGPASSFILE;
Expand Down Expand Up @@ -6106,6 +6129,7 @@ do_witness_register(PGconn *masterconn)
log_notice(_("configuration has been successfully copied to the witness\n"));
}


static void
do_witness_unregister(void)
{
Expand Down

0 comments on commit 20d66df

Please sign in to comment.