mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-22 22:56:29 +00:00
repmgrd: don't wait for WAL receiver to reconnect during failover
If the WAL receiver has been temporarily disabled, we don't want to wait for it to start up as it may not be able to at that point; we do however need to reset "wal_retrieve_retry_interval".
This commit is contained in:
@@ -2707,9 +2707,18 @@ do_node_control(void)
|
|||||||
|
|
||||||
if (runtime_options.enable_wal_receiver == true)
|
if (runtime_options.enable_wal_receiver == true)
|
||||||
{
|
{
|
||||||
wal_receiver_pid = enable_wal_receiver(conn);
|
wal_receiver_pid = enable_wal_receiver(conn, true);
|
||||||
|
|
||||||
|
PQfinish(conn);
|
||||||
|
|
||||||
|
if (wal_receiver_pid == UNKNOWN_PID)
|
||||||
|
exit(ERR_BAD_CONFIG);
|
||||||
|
|
||||||
|
exit(SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log_error(_("no option provided"));
|
||||||
|
|
||||||
PQfinish(conn);
|
PQfinish(conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2078,8 +2078,8 @@ do_primary_failover(void)
|
|||||||
/* Reenable WAL receiver, if disabled and node is not the promotion candidate */
|
/* Reenable WAL receiver, if disabled and node is not the promotion candidate */
|
||||||
if (config_file_options.standby_disconnect_on_failover == true && election_result != ELECTION_WON)
|
if (config_file_options.standby_disconnect_on_failover == true && election_result != ELECTION_WON)
|
||||||
{
|
{
|
||||||
// XXX check return value
|
/* adjust "wal_retrieve_retry_interval" but don't wait for WAL receiver to start */
|
||||||
enable_wal_receiver(local_conn);
|
enable_wal_receiver(local_conn, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (election_result == ELECTION_CANCELLED)
|
if (election_result == ELECTION_CANCELLED)
|
||||||
|
|||||||
@@ -276,7 +276,7 @@ disable_wal_receiver(PGconn *conn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
pid_t
|
pid_t
|
||||||
enable_wal_receiver(PGconn *conn)
|
enable_wal_receiver(PGconn *conn, bool wait_startup)
|
||||||
{
|
{
|
||||||
char buf[MAXLEN];
|
char buf[MAXLEN];
|
||||||
int wal_retrieve_retry_interval;
|
int wal_retrieve_retry_interval;
|
||||||
@@ -326,6 +326,9 @@ enable_wal_receiver(PGconn *conn)
|
|||||||
wal_retrieve_retry_interval);
|
wal_retrieve_retry_interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (wait_startup == false)
|
||||||
|
return UNKNOWN_PID;
|
||||||
|
|
||||||
for (i = 0; i < timeout; i++)
|
for (i = 0; i < timeout; i++)
|
||||||
{
|
{
|
||||||
wal_receiver_pid = (pid_t)get_wal_receiver_pid(conn);
|
wal_receiver_pid = (pid_t)get_wal_receiver_pid(conn);
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ extern bool local_command_simple(const char *command, PQExpBufferData *outputbuf
|
|||||||
extern bool remote_command(const char *host, const char *user, const char *command, const char *ssh_options, PQExpBufferData *outputbuf);
|
extern bool remote_command(const char *host, const char *user, const char *command, const char *ssh_options, PQExpBufferData *outputbuf);
|
||||||
|
|
||||||
extern pid_t disable_wal_receiver(PGconn *conn);
|
extern pid_t disable_wal_receiver(PGconn *conn);
|
||||||
extern pid_t enable_wal_receiver(PGconn *conn);
|
extern pid_t enable_wal_receiver(PGconn *conn, bool wait_startup);
|
||||||
|
|
||||||
|
|
||||||
#endif /* _SYSUTILS_H_ */
|
#endif /* _SYSUTILS_H_ */
|
||||||
|
|||||||
Reference in New Issue
Block a user