Replace hard-coded value with local_options.reconnect_attempts;

This commit is contained in:
Ian Barwick
2015-01-12 14:09:44 +09:00
parent 905a2d0a5e
commit d9f83cf620
2 changed files with 5 additions and 9 deletions

View File

@@ -55,7 +55,7 @@ pg_bindir=/usr/bin/
#
# change wait time for master; before we bail out and exit when the
# master disappears, we wait 6 * retry_promote_interval_secs seconds;
# master disappears, we wait reconnect_attempts * retry_promote_interval_secs seconds;
# by default this would be half an hour (since sleep_delay default
# value is 300)
#

View File

@@ -509,6 +509,7 @@ witness_monitor(void)
sleep(local_options.master_response_timeout);
/* Attempt to find the new master */
for (connection_retries = 0; connection_retries < local_options.reconnect_attempts; connection_retries++)
{
log_info(
@@ -645,8 +646,8 @@ standby_monitor(void)
if (local_options.failover == MANUAL_FAILOVER)
{
log_err(_("We couldn't reconnect to master. Now checking if another node has been promoted.\n"));
// ZZZ why 6 here? make config option?
for (connection_retries = 0; connection_retries < 6; connection_retries++)
for (connection_retries = 0; connection_retries < local_options.reconnect_attempts; connection_retries++)
{
primary_conn = get_master_connection(my_local_conn,
local_options.cluster_name, &primary_options.node, NULL);
@@ -667,12 +668,7 @@ standby_monitor(void)
local_options.retry_promote_interval_secs
);
/*
* 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.retry_promote_interval_secs);
}
}