mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-26 08:36:30 +00:00
Fix parameter checking for STANDBY CLONE
Previous check for the master host was ineffective. We'd be better off explicitly requiring at least hostname, database and usernames for the master rather than relying on whatever defaults were in place when STANDBY CLONE is run, especially as dbname and username are used in recovery.conf.
This commit is contained in:
41
repmgr.c
41
repmgr.c
@@ -2534,11 +2534,11 @@ check_parameters_for_action(const int action)
|
|||||||
if (runtime_options.host[0] || runtime_options.masterport[0] ||
|
if (runtime_options.host[0] || runtime_options.masterport[0] ||
|
||||||
runtime_options.username[0] || runtime_options.dbname[0])
|
runtime_options.username[0] || runtime_options.dbname[0])
|
||||||
{
|
{
|
||||||
error_list_append(_("master connection parameters not required when executing MASTER REGISTER."));
|
error_list_append(_("master connection parameters not required when executing MASTER REGISTER"));
|
||||||
}
|
}
|
||||||
if (runtime_options.dest_dir[0])
|
if (runtime_options.dest_dir[0])
|
||||||
{
|
{
|
||||||
error_list_append(_("destination directory not required when executing MASTER REGISTER."));
|
error_list_append(_("destination directory not required when executing MASTER REGISTER"));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case STANDBY_REGISTER:
|
case STANDBY_REGISTER:
|
||||||
@@ -2551,11 +2551,11 @@ check_parameters_for_action(const int action)
|
|||||||
if (runtime_options.host[0] || runtime_options.masterport[0] ||
|
if (runtime_options.host[0] || runtime_options.masterport[0] ||
|
||||||
runtime_options.username[0] || runtime_options.dbname[0])
|
runtime_options.username[0] || runtime_options.dbname[0])
|
||||||
{
|
{
|
||||||
error_list_append(_("master connection parameters not required when executing STANDBY REGISTER."));
|
error_list_append(_("master connection parameters not required when executing STANDBY REGISTER"));
|
||||||
}
|
}
|
||||||
if (runtime_options.dest_dir[0])
|
if (runtime_options.dest_dir[0])
|
||||||
{
|
{
|
||||||
error_list_append(_("destination directory not required when executing STANDBY REGISTER."));
|
error_list_append(_("destination directory not required when executing STANDBY REGISTER"));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case STANDBY_PROMOTE:
|
case STANDBY_PROMOTE:
|
||||||
@@ -2569,11 +2569,11 @@ check_parameters_for_action(const int action)
|
|||||||
if (runtime_options.host[0] || runtime_options.masterport[0] ||
|
if (runtime_options.host[0] || runtime_options.masterport[0] ||
|
||||||
runtime_options.username[0] || runtime_options.dbname[0])
|
runtime_options.username[0] || runtime_options.dbname[0])
|
||||||
{
|
{
|
||||||
error_list_append(_("master connection parameters not required when executing STANDBY PROMOTE."));
|
error_list_append(_("master connection parameters not required when executing STANDBY PROMOTE"));
|
||||||
}
|
}
|
||||||
if (runtime_options.dest_dir[0])
|
if (runtime_options.dest_dir[0])
|
||||||
{
|
{
|
||||||
error_list_append(_("destination directory not required when executing STANDBY PROMOTE."));
|
error_list_append(_("destination directory not required when executing STANDBY PROMOTE"));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case STANDBY_FOLLOW:
|
case STANDBY_FOLLOW:
|
||||||
@@ -2587,27 +2587,36 @@ check_parameters_for_action(const int action)
|
|||||||
if (runtime_options.host[0] || runtime_options.masterport[0] ||
|
if (runtime_options.host[0] || runtime_options.masterport[0] ||
|
||||||
runtime_options.username[0] || runtime_options.dbname[0])
|
runtime_options.username[0] || runtime_options.dbname[0])
|
||||||
{
|
{
|
||||||
error_list_append(_("master connection parameters not required when executing STANDBY FOLLOW."));
|
error_list_append(_("master connection parameters not required when executing STANDBY FOLLOW"));
|
||||||
}
|
}
|
||||||
if (runtime_options.dest_dir[0])
|
if (runtime_options.dest_dir[0])
|
||||||
{
|
{
|
||||||
error_list_append(_("destination directory not required when executing STANDBY FOLLOW."));
|
error_list_append(_("destination directory not required when executing STANDBY FOLLOW"));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case STANDBY_CLONE:
|
case STANDBY_CLONE:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Previous repmgr versions issued a notice here if a configuration
|
* Explicitly require connection information for standby clone -
|
||||||
* file was provided saying it wasn't needed, which was confusing as
|
* this will be written into `recovery.conf` so it's important to
|
||||||
* it was needed for the `pg_bindir` parameter.
|
* specify it explicitly
|
||||||
*
|
|
||||||
* In any case it's sensible to read the configuration file if available
|
|
||||||
* for `pg_bindir`, `loglevel` and `use_replication_slots`.
|
|
||||||
*/
|
*/
|
||||||
if (runtime_options.host == NULL)
|
|
||||||
|
if (strcmp(runtime_options.host, "") == 0)
|
||||||
{
|
{
|
||||||
log_notice(_("master connection parameters required when executing STANDBY CLONE."));
|
error_list_append(_("master hostname (-h/--host) required when executing STANDBY CLONE"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strcmp(runtime_options.dbname, "") == 0)
|
||||||
|
{
|
||||||
|
error_list_append(_("master database name (-d/--dbname) required when executing STANDBY CLONE"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strcmp(runtime_options.username, "") == 0)
|
||||||
|
{
|
||||||
|
error_list_append(_("master database username (-U/--username) required when executing STANDBY CLONE"));
|
||||||
|
}
|
||||||
|
|
||||||
need_a_node = false;
|
need_a_node = false;
|
||||||
break;
|
break;
|
||||||
case WITNESS_CREATE:
|
case WITNESS_CREATE:
|
||||||
|
|||||||
Reference in New Issue
Block a user