get_all_node_records(): display any error encountered and return success status

In many cases we'll want to bail out with an error if the node list can't
be retrieved for any reason. This saves some repetitive coding.
This commit is contained in:
Ian Barwick
2018-06-26 10:44:31 +09:00
parent bb4fdcda98
commit b0a2ee2259
6 changed files with 41 additions and 18 deletions

View File

@@ -150,7 +150,13 @@ monitor_bdr(void)
* retrieve list of all nodes - we'll need these if the DB connection goes
* away
*/
get_all_node_records(local_conn, &nodes);
if (get_all_node_records(local_conn, &nodes) == false)
{
/* get_all_node_records() will display the error */
PQfinish(local_conn);
exit(ERR_BAD_CONFIG);
}
/* we're expecting all (both) nodes to be up */
for (cell = nodes.head; cell; cell = cell->next)