Rename variable 'reconnect_intvl' to 'reconnect_interval'

For consistency with the configuration file parameter name
This commit is contained in:
Ian Barwick
2015-11-09 11:04:42 +09:00
parent 72b1e57251
commit 8870b7d7f1
3 changed files with 16 additions and 16 deletions

View File

@@ -166,7 +166,7 @@ parse_config(t_configuration_options *options)
/* default to 6 reconnection attempts at intervals of 10 seconds */
options->reconnect_attempts = 6;
options->reconnect_intvl = 10;
options->reconnect_interval = 10;
options->monitor_interval_secs = 2;
options->retry_promote_interval_secs = 300;
@@ -249,7 +249,7 @@ parse_config(t_configuration_options *options)
else if (strcmp(name, "reconnect_attempts") == 0)
options->reconnect_attempts = repmgr_atoi(value, "reconnect_attempts", NULL);
else if (strcmp(name, "reconnect_interval") == 0)
options->reconnect_intvl = repmgr_atoi(value, "reconnect_interval", NULL);
options->reconnect_interval = repmgr_atoi(value, "reconnect_interval", NULL);
else if (strcmp(name, "pg_bindir") == 0)
strncpy(options->pg_bindir, value, MAXLEN);
else if (strcmp(name, "pg_ctl_options") == 0)
@@ -350,7 +350,7 @@ parse_config(t_configuration_options *options)
exit(ERR_BAD_CONFIG);
}
if (options->reconnect_intvl < 0)
if (options->reconnect_interval < 0)
{
log_err(_("'reconnect_interval' must be zero or greater\n"));
exit(ERR_BAD_CONFIG);
@@ -501,7 +501,7 @@ reload_config(t_configuration_options *orig_options)
return false;
}
if (new_options.reconnect_intvl < 0)
if (new_options.reconnect_interval < 0)
{
log_warning(_("new value for 'reconnect_interval' must be zero or greater\n"));
return false;
@@ -620,10 +620,10 @@ reload_config(t_configuration_options *orig_options)
config_changed = true;
}
/* reconnect_intvl */
if (orig_options->reconnect_intvl != new_options.reconnect_intvl)
/* reconnect_interval */
if (orig_options->reconnect_interval != new_options.reconnect_interval)
{
orig_options->reconnect_intvl = new_options.reconnect_intvl;
orig_options->reconnect_interval = new_options.reconnect_interval;
config_changed = true;
}

View File

@@ -67,7 +67,7 @@ typedef struct
char ssh_options[QUERY_STR_LEN];
int master_response_timeout;
int reconnect_attempts;
int reconnect_intvl;
int reconnect_interval;
char pg_bindir[MAXLEN];
char pg_ctl_options[MAXLEN];
char pg_basebackup_options[MAXLEN];

View File

@@ -561,10 +561,10 @@ witness_monitor(void)
{
log_warning(
_("unable to determine a valid master server; waiting %i seconds to retry...\n"),
local_options.reconnect_intvl
local_options.reconnect_interval
);
PQfinish(master_conn);
sleep(local_options.reconnect_intvl);
sleep(local_options.reconnect_interval);
}
else
{
@@ -742,7 +742,7 @@ standby_monitor(void)
check_connection(&upstream_conn, type, upstream_conninfo);
/*
* This takes up to local_options.reconnect_attempts *
* local_options.reconnect_intvl seconds
* local_options.reconnect_interval seconds
*/
if (PQstatus(upstream_conn) != CONNECTION_OK)
@@ -1720,7 +1720,7 @@ do_upstream_standby_failover(t_node_info upstream_node)
}
PQclear(res);
sleep(local_options.reconnect_intvl);
sleep(local_options.reconnect_interval);
}
/* Close the connection to this server */
@@ -1793,7 +1793,7 @@ check_connection(PGconn **conn, const char *type, const char *conninfo)
/*
* Check if the node is still available if after
* local_options.reconnect_attempts * local_options.reconnect_intvl
* local_options.reconnect_attempts * local_options.reconnect_interval
* seconds of retries we cannot reconnect return false
*/
for (connection_retries = 0; connection_retries < local_options.reconnect_attempts; connection_retries++)
@@ -1811,9 +1811,9 @@ check_connection(PGconn **conn, const char *type, const char *conninfo)
{
log_warning(_("connection to %s has been lost, trying to recover... %i seconds before failover decision\n"),
type,
(local_options.reconnect_intvl * (local_options.reconnect_attempts - connection_retries)));
/* wait local_options.reconnect_intvl seconds between retries */
sleep(local_options.reconnect_intvl);
(local_options.reconnect_interval * (local_options.reconnect_attempts - connection_retries)));
/* wait local_options.reconnect_interval seconds between retries */
sleep(local_options.reconnect_interval);
}
else
{