From ed1bcb159e60de79f54d90348233255ebb16e9af Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Tue, 6 Mar 2018 12:31:07 +0900 Subject: [PATCH] repmgrd: remove duplicate local record check in BDR mode --- repmgrd-bdr.c | 17 ----------------- repmgrd.c | 16 +++++++++++++++- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/repmgrd-bdr.c b/repmgrd-bdr.c index 72c7d948..4b51b118 100644 --- a/repmgrd-bdr.c +++ b/repmgrd-bdr.c @@ -121,23 +121,6 @@ monitor_bdr(void) exit(ERR_BAD_CONFIG); } - /* Retrieve record for this node from the local database */ - record_status = get_node_record(local_conn, config_file_options.node_id, &local_node_info); - - /* - * Terminate if we can't find the local node record. This is a - * "fix-the-config" situation, not a lot else we can do. - */ - if (record_status != RECORD_FOUND) - { - log_error(_("unable to retrieve record for local node (ID: %i), terminating"), - local_node_info.node_id); - log_hint(_("check that \"repmgr bdr register\" was executed for this node")); - PQfinish(local_conn); - exit(ERR_BAD_CONFIG); - } - - if (local_node_info.active == false) { log_error(_("local node (ID: %i) is marked as inactive in repmgr"), diff --git a/repmgrd.c b/repmgrd.c index 4b55c9d6..78d4fc82 100644 --- a/repmgrd.c +++ b/repmgrd.c @@ -354,10 +354,24 @@ main(int argc, char **argv) /* Retrieve record for this node from the local database */ record_status = get_node_record(local_conn, config_file_options.node_id, &local_node_info); + /* + * Terminate if we can't find the local node record. This is a + * "fix-the-config" situation, not a lot else we can do. + */ + if (record_status != RECORD_FOUND) { log_error(_("no metadata record found for this node - terminating")); - log_hint(_("check that 'repmgr (primary|standby) register' was executed for this node")); + + switch (config_file_options.replication_type) + { + case REPLICATION_TYPE_PHYSICAL: + log_hint(_("check that 'repmgr (primary|standby) register' was executed for this node")); + break; + case REPLICATION_TYPE_BDR: + log_hint(_("check that 'repmgr bdr register' was executed for this node")); + break; + } PQfinish(local_conn); terminate(ERR_BAD_CONFIG);