mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-25 16:16:29 +00:00
repmgrd: synchronise repmgr.nodes table on witness server
This commit is contained in:
@@ -1032,6 +1032,8 @@ monitor_streaming_witness(void)
|
|||||||
{
|
{
|
||||||
#ifndef BDR_ONLY
|
#ifndef BDR_ONLY
|
||||||
instr_time log_status_interval_start;
|
instr_time log_status_interval_start;
|
||||||
|
instr_time witness_sync_interval_start;
|
||||||
|
|
||||||
PQExpBufferData event_details;
|
PQExpBufferData event_details;
|
||||||
RecordStatus record_status;
|
RecordStatus record_status;
|
||||||
|
|
||||||
@@ -1065,7 +1067,8 @@ monitor_streaming_witness(void)
|
|||||||
exit(ERR_DB_CONN);
|
exit(ERR_DB_CONN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* synchronise local copy of "repmgr.nodes", in case it was stale */
|
||||||
|
witness_copy_node_records(primary_conn, local_conn);
|
||||||
/*
|
/*
|
||||||
* refresh upstream node record from primary, so it's as up-to-date
|
* refresh upstream node record from primary, so it's as up-to-date
|
||||||
* as possible
|
* as possible
|
||||||
@@ -1101,6 +1104,8 @@ monitor_streaming_witness(void)
|
|||||||
|
|
||||||
monitoring_state = MS_NORMAL;
|
monitoring_state = MS_NORMAL;
|
||||||
INSTR_TIME_SET_CURRENT(log_status_interval_start);
|
INSTR_TIME_SET_CURRENT(log_status_interval_start);
|
||||||
|
INSTR_TIME_SET_CURRENT(witness_sync_interval_start);
|
||||||
|
|
||||||
upstream_node_info.node_status = NODE_STATUS_UP;
|
upstream_node_info.node_status = NODE_STATUS_UP;
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
@@ -1182,7 +1187,17 @@ monitor_streaming_witness(void)
|
|||||||
}
|
}
|
||||||
loop:
|
loop:
|
||||||
|
|
||||||
// XXX refresh repmgr.nodes
|
/* refresh repmgr.nodes after "witness_sync_interval" seconds */
|
||||||
|
|
||||||
|
{
|
||||||
|
int witness_sync_interval_elapsed = calculate_elapsed(witness_sync_interval_start);
|
||||||
|
if (witness_sync_interval_elapsed >= config_file_options.witness_sync_interval)
|
||||||
|
{
|
||||||
|
log_debug("synchronising witness node records");
|
||||||
|
witness_copy_node_records(primary_conn, local_conn);
|
||||||
|
INSTR_TIME_SET_CURRENT(witness_sync_interval_start);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* emit "still alive" log message at regular intervals, if requested */
|
/* emit "still alive" log message at regular intervals, if requested */
|
||||||
if (config_file_options.log_status_interval > 0)
|
if (config_file_options.log_status_interval > 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user