renamed config options to a much more descriptive name

This commit is contained in:
Christian Kruse
2014-01-21 15:19:50 +01:00
parent 388bbfb773
commit 7cf2eb440d
4 changed files with 20 additions and 19 deletions

View File

@@ -52,8 +52,8 @@ parse_config(const char *config_file, t_configuration_options *options)
options->reconnect_attempts = 6;
options->reconnect_intvl = 10;
options->sleep_monitor = 2;
options->sleep_delay = 300;
options->monitor_interval_secs = 2;
options->retry_promote_interval_secs = 300;
/*
* Since some commands don't require a config file at all, not
@@ -125,10 +125,10 @@ parse_config(const char *config_file, t_configuration_options *options)
strncpy (options->pgctl_options, value, MAXLEN);
else if (strcmp(name, "logfile") == 0)
strncpy(options->logfile, value, MAXLEN);
else if (strcmp(name, "sleep_monitor") == 0)
options->sleep_monitor = atoi(value);
else if (strcmp(name, "sleep_delay") == 0)
options->sleep_delay = atoi(value);
else if (strcmp(name, "monitor_interval_secs") == 0)
options->monitor_interval_secs = atoi(value);
else if (strcmp(name, "retry_promote_interval_secs") == 0)
options->retry_promote_interval_secs = atoi(value);
else
log_warning(_("%s/%s: Unknown name/value pair!\n"), name, value);
}

View File

@@ -43,8 +43,8 @@ typedef struct
char pg_bindir[MAXLEN];
char pgctl_options[MAXLEN];
char logfile[MAXLEN];
int sleep_monitor;
int sleep_delay;
int monitor_interval_secs;
int retry_promote_interval_secs;
} t_configuration_options;
#define T_CONFIGURATION_OPTIONS_INITIALIZER { "", -1, "", MANUAL_FAILOVER, -1, "", "", "", "", "", "", "", -1, -1, -1, "", "", "", 0, 0 }

View File

@@ -51,11 +51,12 @@ pg_bindir=/usr/bin/
#
# change monitoring interval; default is 2s
#
# sleep_monitor=2
# monitor_interval_secs=2
#
# change wait time for master; before we bail out and exit when the
# master disappears, we wait 6 * sleep_delay seconds; by default this
# would be half an hour (since sleep_delay default value is 300)
# master disappears, we wait 6 * retry_promote_interval_secs seconds;
# by default this would be half an hour (since sleep_delay default
# value is 300)
#
# sleep_delay=300
# retry_promote_interval_secs=300

View File

@@ -358,7 +358,7 @@ main(int argc, char **argv)
/* Check that primary is still alive, and standbies are sending info */
/*
* Every local_options.sleep_monitor seconds, do master checks
* Every local_options.monitor_interval_secs seconds, do master checks
* XXX
* Check that standbies are sending info
*/
@@ -370,7 +370,7 @@ main(int argc, char **argv)
CheckActiveStandbiesConnections();
CheckInactiveStandbies();
*/
sleep(local_options.sleep_monitor);
sleep(local_options.monitor_interval_secs);
}
else
{
@@ -424,7 +424,7 @@ main(int argc, char **argv)
}
/*
* Every local_options.sleep_monitor seconds, do checks
* Every local_options.monitor_interval_secs seconds, do checks
*/
if (myLocalMode == WITNESS_MODE)
{
@@ -441,7 +441,7 @@ main(int argc, char **argv)
WitnessMonitor();
else if (myLocalMode == STANDBY_MODE)
StandbyMonitor();
sleep(local_options.sleep_monitor);
sleep(local_options.monitor_interval_secs);
if (got_SIGHUP)
{
@@ -600,10 +600,10 @@ StandbyMonitor(void)
else
{
log_err(_("We haven't found a new master, waiting before retry...\n"));
/* wait local_options.sleep_delay minutes before retries,
* after 6 failures (6 * local_options.sleep_monitor
/* wait local_options.retry_promote_interval_secs minutes before retries,
* after 6 failures (6 * local_options.monitor_interval_secs
* seconds) we stop trying */
sleep(local_options.sleep_delay);
sleep(local_options.retry_promote_interval_secs);
}
}