From b7b9db7e9c58b62030ac0509231956dd61eb80bb Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Fri, 5 Apr 2019 14:32:55 +0900 Subject: [PATCH] Ensure BDR-specific code only runs on BDR 2.x The BDR support in repmgr is for a specific BDR 2.x use case, and is not suitable for more recent BDR versions. --- repmgr-action-bdr.c | 9 +++++++++ repmgrd-bdr.c | 12 ++++++++++++ 2 files changed, 21 insertions(+) diff --git a/repmgr-action-bdr.c b/repmgr-action-bdr.c index 91f86385..9a731fcb 100644 --- a/repmgr-action-bdr.c +++ b/repmgr-action-bdr.c @@ -93,6 +93,15 @@ do_bdr_register(void) exit(ERR_BAD_CONFIG); } + if (get_bdr_version_num() > 2) + { + log_error(_("\"repmgr bdr register\" is for BDR 2.x only")); + PQfinish(conn); + pfree(dbname); + exit(ERR_BAD_CONFIG); + } + + /* check for a matching BDR node */ { PQExpBufferData bdr_local_node_name; diff --git a/repmgrd-bdr.c b/repmgrd-bdr.c index c3d105c7..c3b38441 100644 --- a/repmgrd-bdr.c +++ b/repmgrd-bdr.c @@ -96,9 +96,21 @@ monitor_bdr(void) if (!is_bdr_db(local_conn, NULL)) { log_error(_("database is not BDR-enabled")); + PQfinish(local_conn); exit(ERR_BAD_CONFIG); } + /* + * Check this is a supported BDR version (basically BDR 2.x) + */ + if (get_bdr_version_num() > 2) + { + log_error(_("\"bdr\" mode is for BDR 2.x only")); + log_hint(_("for BDR 3 and later, use \"replication_type=physical\"")); + log_error(_("database is not BDR-enabled")); + exit(ERR_DB_CONN); + } + if (is_table_in_bdr_replication_set(local_conn, "nodes", "repmgr") == false) { log_error(_("repmgr metadata table 'repmgr.%s' is not in the 'repmgr' replication set"),