added config options sleep_delay and sleep_monitor

sleep_monitor replaces the old SLEEP_MONITOR define and makes it
configurable; this is the interval in which we monitor

sleep_delay replaces the old sleep(300) when waiting for the master to
recover.
This commit is contained in:
Christian Kruse
2014-01-17 13:50:12 +01:00
parent a7d3c9b93a
commit 5fc4a0382f
5 changed files with 30 additions and 9 deletions

View File

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