mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-25 16:16:29 +00:00
Replace hard-coded value with local_options.reconnect_attempts;
This commit is contained in:
@@ -55,7 +55,7 @@ pg_bindir=/usr/bin/
|
|||||||
|
|
||||||
#
|
#
|
||||||
# change wait time for master; before we bail out and exit when the
|
# 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
|
# by default this would be half an hour (since sleep_delay default
|
||||||
# value is 300)
|
# value is 300)
|
||||||
#
|
#
|
||||||
|
|||||||
12
repmgrd.c
12
repmgrd.c
@@ -509,6 +509,7 @@ witness_monitor(void)
|
|||||||
|
|
||||||
sleep(local_options.master_response_timeout);
|
sleep(local_options.master_response_timeout);
|
||||||
|
|
||||||
|
/* Attempt to find the new master */
|
||||||
for (connection_retries = 0; connection_retries < local_options.reconnect_attempts; connection_retries++)
|
for (connection_retries = 0; connection_retries < local_options.reconnect_attempts; connection_retries++)
|
||||||
{
|
{
|
||||||
log_info(
|
log_info(
|
||||||
@@ -645,8 +646,8 @@ standby_monitor(void)
|
|||||||
if (local_options.failover == MANUAL_FAILOVER)
|
if (local_options.failover == MANUAL_FAILOVER)
|
||||||
{
|
{
|
||||||
log_err(_("We couldn't reconnect to master. Now checking if another node has been promoted.\n"));
|
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,
|
primary_conn = get_master_connection(my_local_conn,
|
||||||
local_options.cluster_name, &primary_options.node, NULL);
|
local_options.cluster_name, &primary_options.node, NULL);
|
||||||
@@ -667,12 +668,7 @@ standby_monitor(void)
|
|||||||
local_options.retry_promote_interval_secs
|
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);
|
sleep(local_options.retry_promote_interval_secs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user