mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-26 00:26:30 +00:00
Speed up witness "failover" during a switchover
This commit is contained in:
@@ -4087,9 +4087,25 @@ do_standby_switchover(void)
|
|||||||
|
|
||||||
if (sibling_node_record.type == WITNESS)
|
if (sibling_node_record.type == WITNESS)
|
||||||
{
|
{
|
||||||
|
/* TODO: create "repmgr witness resync" or similar */
|
||||||
appendPQExpBuffer(&remote_command_str,
|
appendPQExpBuffer(&remote_command_str,
|
||||||
"witness register -d \\'%s\\' --force 2>/dev/null && echo \"1\" || echo \"0\"",
|
"witness register -d \\'%s\\' --force 2>/dev/null && echo \"1\" || echo \"0\"",
|
||||||
local_node_record.conninfo);
|
local_node_record.conninfo);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Notify the witness repmgrd about the new primary, as at this point it will be assuming
|
||||||
|
* a failover situation is in place. It will detect the new primary at some point, this
|
||||||
|
* just speeds up the process.
|
||||||
|
*
|
||||||
|
* In the unlikely event repmgrd is not running or not in use, this will have no effect.
|
||||||
|
*/
|
||||||
|
cell->node_info->conn = establish_db_connection_quiet(cell->node_info->conninfo);
|
||||||
|
|
||||||
|
if (PQstatus(cell->node_info->conn) == CONNECTION_OK)
|
||||||
|
{
|
||||||
|
notify_follow_primary(cell->node_info->conn, local_node_record.node_id);
|
||||||
|
}
|
||||||
|
PQfinish(cell->node_info->conn);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user