mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-26 08:36:30 +00:00
"standby clone": exit early in pg_basebackup mode if data directory is not empty
This commit is contained in:
@@ -568,6 +568,22 @@ check_source_server()
|
|||||||
log_hint(_("use -D/--pgdata to explicitly specify a data directory"));
|
log_hint(_("use -D/--pgdata to explicitly specify a data directory"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* In the default pg_basebackup mode, we'll cowardly refuse to overwrite
|
||||||
|
* an existing data directory
|
||||||
|
*/
|
||||||
|
if (mode == pg_basebackup)
|
||||||
|
{
|
||||||
|
if (is_pg_dir(local_data_directory))
|
||||||
|
{
|
||||||
|
log_error(_("target data directory appears to be a PostgreSQL data directory"));
|
||||||
|
log_detail(_("target data directory is \"%s\""), local_data_directory);
|
||||||
|
log_hint(_("ensure the target data directory is empty before running \"STANDBY CLONE\" in pg_basebackup mode"));
|
||||||
|
PQfinish(source_conn);
|
||||||
|
exit(ERR_BAD_CONFIG);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copy the source connection so that we have some default values,
|
* Copy the source connection so that we have some default values,
|
||||||
* particularly stuff like passwords extracted from PGPASSFILE;
|
* particularly stuff like passwords extracted from PGPASSFILE;
|
||||||
|
|||||||
Reference in New Issue
Block a user