mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-22 22:56:29 +00:00
Previously, if the server being monitored was not available, repmgrd would always close the existing connection handle and open a new one. However, in some cases, e.g. a brief network outage, the existing connection handle is still good and does not need to be reopened. This could be particularly problematic if monitoring_history is on, as this risks leaving orphan sessions on the primary which (given a sufficiently unstable network) could lead to all available backends being occupied. Instead, during an outage we now use a new connection to verify the server is accessible; if the old connection is still available (e.g. following a short network interruption) we continue using that; if not (e.g. the server was restarted), we use the new one.
34 lines
766 B
C
34 lines
766 B
C
/*
|
|
* repmgrd.h
|
|
* Copyright (c) 2ndQuadrant, 2010-2018
|
|
*/
|
|
|
|
|
|
#ifndef _REPMGRD_H_
|
|
#define _REPMGRD_H_
|
|
|
|
#include <time.h>
|
|
#include "portability/instr_time.h"
|
|
|
|
#define OPT_NO_PID_FILE 1000
|
|
|
|
extern volatile sig_atomic_t got_SIGHUP;
|
|
extern MonitoringState monitoring_state;
|
|
extern instr_time degraded_monitoring_start;
|
|
|
|
extern t_configuration_options config_file_options;
|
|
extern t_node_info local_node_info;
|
|
extern PGconn *local_conn;
|
|
extern bool startup_event_logged;
|
|
|
|
void try_reconnect(PGconn **conn, t_node_info *node_info);
|
|
|
|
int calculate_elapsed(instr_time start_time);
|
|
const char *print_monitoring_state(MonitoringState monitoring_state);
|
|
|
|
void update_registration(PGconn *conn);
|
|
void terminate(int retval);
|
|
|
|
|
|
#endif /* _REPMGRD_H_ */
|