Ensure witness server updates its node records following a failover

This involves mainly abstracting the functions which copy
and create records from repmgr.c to dbutils.c, as they need
to be shared between repmgr and repmgrd.

Per issue noted here:

  https://groups.google.com/forum/#!topic/repmgr/v5nu1Xwf6X0
This commit is contained in:
Ian Barwick
2015-03-03 08:57:20 +09:00
parent db5db06244
commit 3d3f082617
4 changed files with 172 additions and 144 deletions

View File

@@ -519,7 +519,7 @@ witness_monitor(void)
local_options.reconnect_attempts
);
primary_conn = get_master_connection(my_local_conn,
local_options.cluster_name, &primary_options.node, NULL);
local_options.cluster_name, &primary_options.node, NULL);
if (PQstatus(primary_conn) != CONNECTION_OK)
{
@@ -534,6 +534,16 @@ witness_monitor(void)
{
log_debug(_("New master found with node ID: %i\n"), primary_options.node);
connection_ok = true;
/*
* Update the repl_nodes table from the new primary to reflect the changed
* node configuration
*
* XXX it would be neat to be able to handle this with e.g. table-based
* logical replication
*/
copy_configuration(primary_conn, my_local_conn, local_options.cluster_name);
break;
}
}