mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-23 07:06:30 +00:00
Use existing config file options when attempting to connect to server during switchover
This commit is contained in:
14
repmgr.c
14
repmgr.c
@@ -931,7 +931,6 @@ do_master_register(void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Now register the master */
|
||||
record_created = create_node_record(conn,
|
||||
"master register",
|
||||
@@ -1218,8 +1217,6 @@ do_standby_clone(void)
|
||||
keywords[1] = "port";
|
||||
values[1] = runtime_options.masterport;
|
||||
|
||||
/* XXX provide user too? */
|
||||
|
||||
/* Connect to check configuration */
|
||||
log_info(_("connecting to upstream node\n"));
|
||||
upstream_conn = establish_db_connection_by_params(keywords, values, true);
|
||||
@@ -2264,8 +2261,6 @@ do_standby_switchover(void)
|
||||
char remote_host[MAXLEN];
|
||||
char remote_data_directory[MAXLEN];
|
||||
int remote_node_id;
|
||||
// make configurable?
|
||||
int remote_reconnection_max_attempts = 10;
|
||||
char remote_node_replication_state[MAXLEN] = "";
|
||||
int i,
|
||||
r = 0;
|
||||
@@ -2504,7 +2499,7 @@ do_standby_switchover(void)
|
||||
|
||||
/* loop for timeout waiting for current primary to stop */
|
||||
|
||||
for(i = 0; i < remote_reconnection_max_attempts; i++)
|
||||
for(i = 0; i < options.reconnect_attempts; i++)
|
||||
{
|
||||
/* Check whether primary is available */
|
||||
|
||||
@@ -2526,7 +2521,7 @@ do_standby_switchover(void)
|
||||
PQfinish(remote_conn);
|
||||
|
||||
// configurable?
|
||||
sleep(1);
|
||||
sleep(options.reconnect_interval);
|
||||
i++;
|
||||
}
|
||||
|
||||
@@ -2579,7 +2574,7 @@ do_standby_switchover(void)
|
||||
|
||||
connection_success = false;
|
||||
|
||||
for(i = 0; i < remote_reconnection_max_attempts; i++)
|
||||
for(i = 0; i < options.reconnect_attempts; i++)
|
||||
{
|
||||
/* Check whether primary is available */
|
||||
|
||||
@@ -2598,8 +2593,7 @@ do_standby_switchover(void)
|
||||
}
|
||||
PQfinish(remote_conn);
|
||||
|
||||
// configurable?
|
||||
sleep(1);
|
||||
sleep(options.reconnect_interval);
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
@@ -121,8 +121,9 @@ logfacility=STDERR
|
||||
|
||||
master_response_timeout=60
|
||||
|
||||
# Number of times to try and reconnect to the primary before starting
|
||||
# the failover procedure
|
||||
# Number of attempts at what interval (in seconds) to try and
|
||||
# connect to a server to establish its status (e.g. master
|
||||
# during failover)
|
||||
reconnect_attempts=6
|
||||
reconnect_interval=10
|
||||
|
||||
|
||||
Reference in New Issue
Block a user