Skip to content

Commit

Permalink
"standby switchover": close all connections used to check repmgrd status
Browse files Browse the repository at this point in the history
The connections used to check repmgrd status on all nodes were not being
closed if repmgrd was not running. Normally this wouldn't be a huge
problem as they will go away when repmgr terminates or the PostgreSQL
server restarted. However, if shutdown mode is "smart", the open
connection on the demotion candidate will cause the shutdown operation
to fail until repmgr times out.
  • Loading branch information
ibarwick committed Oct 23, 2018
1 parent a4e21fd commit 79e79bd
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions repmgr-action-standby.c
Original file line number Diff line number Diff line change
Expand Up @@ -3718,9 +3718,18 @@ do_standby_switchover(void)
i++;
}
}

else
{
/* close all connections - we'll reestablish later */
for (cell = all_nodes.head; cell; cell = cell->next)
{
PQfinish(cell->node_info->conn);
cell->node_info->conn = NULL;
}
}
}


/*
* Sanity checks completed - prepare for the switchover
*/
Expand Down Expand Up @@ -3801,7 +3810,7 @@ do_standby_switchover(void)
shutdown_command);

clear_node_info_list(&sibling_nodes);
clear_node_info_list(&all_nodes);

key_value_list_free(&remote_config_files);

return;
Expand Down Expand Up @@ -4160,8 +4169,6 @@ do_standby_switchover(void)

clear_node_info_list(&sibling_nodes);



PQfinish(local_conn);

/*
Expand Down

0 comments on commit 79e79bd

Please sign in to comment.