mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-26 08:36:30 +00:00
repmgr: avoid spurious cluster name errors during 'standby switchover'
'standby restore-config' doesn't require a configuration file, but pass it anyway. Addresses GitHub #269
This commit is contained in:
24
repmgr.c
24
repmgr.c
@@ -5264,7 +5264,7 @@ do_standby_switchover(void)
|
|||||||
appendPQExpBuffer(&remote_command_str,
|
appendPQExpBuffer(&remote_command_str,
|
||||||
"%s standby archive-config -f ",
|
"%s standby archive-config -f ",
|
||||||
make_pg_path("repmgr"));
|
make_pg_path("repmgr"));
|
||||||
appendShellString(&remote_command_str, runtime_options.remote_config_file);
|
appendShellString(&remote_command_str, runtime_options.remote_config_file);
|
||||||
appendPQExpBuffer(&remote_command_str,
|
appendPQExpBuffer(&remote_command_str,
|
||||||
" --config-archive-dir=");
|
" --config-archive-dir=");
|
||||||
appendShellString(&remote_command_str, remote_archive_config_dir);
|
appendShellString(&remote_command_str, remote_archive_config_dir);
|
||||||
@@ -5438,12 +5438,22 @@ do_standby_switchover(void)
|
|||||||
/* Restore any previously archived config files */
|
/* Restore any previously archived config files */
|
||||||
initPQExpBuffer(&remote_command_str);
|
initPQExpBuffer(&remote_command_str);
|
||||||
|
|
||||||
|
/* --force */
|
||||||
appendPQExpBuffer(&remote_command_str,
|
appendPQExpBuffer(&remote_command_str,
|
||||||
"%s standby restore-config -D ",
|
"%s standby restore-config -D ",
|
||||||
make_pg_path("repmgr"));
|
make_pg_path("repmgr"));
|
||||||
appendShellString(&remote_command_str, remote_data_directory);
|
appendShellString(&remote_command_str, remote_data_directory);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* append pass the configuration file to prevent spurious errors
|
||||||
|
* about missing cluster_name
|
||||||
|
*/
|
||||||
appendPQExpBuffer(&remote_command_str,
|
appendPQExpBuffer(&remote_command_str,
|
||||||
" --config-archive-dir=");
|
" -f ");
|
||||||
|
appendShellString(&remote_command_str, runtime_options.remote_config_file);
|
||||||
|
|
||||||
|
appendPQExpBuffer(&remote_command_str,
|
||||||
|
" --config-archive-dir=");
|
||||||
appendShellString(&remote_command_str, remote_archive_config_dir);
|
appendShellString(&remote_command_str, remote_archive_config_dir);
|
||||||
|
|
||||||
initPQExpBuffer(&command_output);
|
initPQExpBuffer(&command_output);
|
||||||
@@ -5897,11 +5907,13 @@ do_standby_restore_config(void)
|
|||||||
|
|
||||||
if (rmdir(runtime_options.config_archive_dir) != 0 && errno != EEXIST)
|
if (rmdir(runtime_options.config_archive_dir) != 0 && errno != EEXIST)
|
||||||
{
|
{
|
||||||
log_err(_("Unable to delete %s\n"), runtime_options.config_archive_dir);
|
log_warning(_("unable to delete %s\n"), runtime_options.config_archive_dir);
|
||||||
exit(ERR_BAD_CONFIG);
|
log_detail(_("directory may need to be manually removed\n"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
log_verbose(LOG_NOTICE, "directory %s deleted\n", runtime_options.config_archive_dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
log_verbose(LOG_NOTICE, "Directory %s deleted\n", runtime_options.config_archive_dir);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user