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