Skip to content

Commit

Permalink
repmgrd: ensure witness node metadata is updated
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ibarwick committed Jun 8, 2023
1 parent ef96243 commit 9ab4ace
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
5 changes: 4 additions & 1 deletion HISTORY
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
5.4.1 2023-??-??
repmgrd: ensure witness node metadata is updated (Ian)

5.4.0 2023-03-16
Support cloning replicas using pg-backup-api
Support cloning replicas using pg-backup-api

5.3.3 2022-10-17
Support for PostgreSQL added
Expand Down
24 changes: 23 additions & 1 deletion doc/appendix-release-notes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,29 @@
</para>

<!-- remember to update the release date in ../repmgr_version.h.in -->
<sect1 id="release-5.4.1">
<title id="release-current">Release 5.4.1</title>
<para><emphasis>??? ?? ??????, 202?</emphasis></para>
<para>
&repmgr; 5.4.1 is a minor release providing ...
</para>
<sect2>
<title>Bug fixes</title>
<para>
<itemizedlist>
<listitem>
<para>
&repmgrd;: ensure witness node metadata is updated if the primary
node changed while the witness &repmgrd; was not running.
</para>
</listitem>
</itemizedlist>
</para>
</sect2>
</sect1>

<sect1 id="release-5.4.0">
<title id="release-current">Release 5.4.0</title>
<title>Release 5.4.0</title>
<para><emphasis>Thu 15 March, 2023</emphasis></para>
<para>
&repmgr; 5.4.0 is a major release.
Expand All @@ -29,6 +50,7 @@
<para>
Minor fixes to the documentation.
</para>
</sect1>

<sect1 id="release-5.3.3">
<title>Release 5.3.3</title>
Expand Down
11 changes: 11 additions & 0 deletions repmgrd-physical.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 9ab4ace

Please sign in to comment.