mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-26 08:36:30 +00:00
Always pass -D/--pgdata option to pg_basebackup
repmgr does not require explicit provision of the target data directory when cloning a standby (it defaults to the same directory as on the master). However this is a required option for pg_basebackup which was only being provided if repmgr's -D/--data-dir option was set, so ensure we always provide whatever repmgr is using. Per report from Martín.
This commit is contained in:
13
repmgr.c
13
repmgr.c
@@ -69,7 +69,7 @@ static bool create_recovery_file(const char *data_dir);
|
|||||||
static int test_ssh_connection(char *host, char *remote_user);
|
static int test_ssh_connection(char *host, char *remote_user);
|
||||||
static int copy_remote_files(char *host, char *remote_user, char *remote_path,
|
static int copy_remote_files(char *host, char *remote_user, char *remote_path,
|
||||||
char *local_path, bool is_directory, int server_version_num);
|
char *local_path, bool is_directory, int server_version_num);
|
||||||
static int run_basebackup(void);
|
static int run_basebackup(const char *data_dir);
|
||||||
static void check_parameters_for_action(const int action);
|
static void check_parameters_for_action(const int action);
|
||||||
static bool create_schema(PGconn *conn);
|
static bool create_schema(PGconn *conn);
|
||||||
static void write_primary_conninfo(char *line);
|
static void write_primary_conninfo(char *line);
|
||||||
@@ -1321,7 +1321,7 @@ do_standby_clone(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
r = run_basebackup();
|
r = run_basebackup(local_data_directory);
|
||||||
if (r != 0)
|
if (r != 0)
|
||||||
{
|
{
|
||||||
log_warning(_("standby clone: base backup failed\n"));
|
log_warning(_("standby clone: base backup failed\n"));
|
||||||
@@ -2489,7 +2489,7 @@ copy_remote_files(char *host, char *remote_user, char *remote_path,
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
run_basebackup()
|
run_basebackup(const char *data_dir)
|
||||||
{
|
{
|
||||||
char script[MAXLEN];
|
char script[MAXLEN];
|
||||||
int r = 0;
|
int r = 0;
|
||||||
@@ -2500,6 +2500,8 @@ run_basebackup()
|
|||||||
|
|
||||||
initPQExpBuffer(¶ms);
|
initPQExpBuffer(¶ms);
|
||||||
|
|
||||||
|
appendPQExpBuffer(¶ms, " -D %s", data_dir);
|
||||||
|
|
||||||
if(strlen(runtime_options.host))
|
if(strlen(runtime_options.host))
|
||||||
{
|
{
|
||||||
appendPQExpBuffer(¶ms, " -h %s", runtime_options.host);
|
appendPQExpBuffer(¶ms, " -h %s", runtime_options.host);
|
||||||
@@ -2515,11 +2517,6 @@ run_basebackup()
|
|||||||
appendPQExpBuffer(¶ms, " -U %s", runtime_options.username);
|
appendPQExpBuffer(¶ms, " -U %s", runtime_options.username);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(strlen(runtime_options.dest_dir))
|
|
||||||
{
|
|
||||||
appendPQExpBuffer(¶ms, " -D %s", runtime_options.dest_dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(runtime_options.fast_checkpoint) {
|
if(runtime_options.fast_checkpoint) {
|
||||||
appendPQExpBuffer(¶ms, " -c fast");
|
appendPQExpBuffer(¶ms, " -c fast");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user