repmgrd: ensure witness node metadata is updated

If the primary changed while the witness repmgrd was not running,
ensure the witness's upstream node ID is updated when the witness
repmgrd is restarted.
This commit is contained in:
Ian Barwick
2023-06-08 16:35:56 +09:00
parent ef962436f7
commit 9ab4acea78
3 changed files with 38 additions and 2 deletions

View File

@@ -2394,6 +2394,17 @@ monitor_streaming_witness(void)
terminate(ERR_BAD_CONFIG);
}
/*
* It's possible that the primary changed while the witness repmgrd was not
* running. This does not affect the functionality of the witness repmgrd, but
* does mean outdated node metadata will be displayed, so update that.
*/
if (local_node_info.upstream_node_id != primary_node_id)
{
update_node_record_set_upstream(primary_conn, local_node_info.node_id, primary_node_id);
local_node_info.upstream_node_id = primary_node_id;
}
initPQExpBuffer(&event_details);
appendPQExpBuffer(&event_details,