diff --git a/HISTORY b/HISTORY
index 2465de84..9db23055 100644
--- a/HISTORY
+++ b/HISTORY
@@ -1,6 +1,7 @@
4.3 2019-??
repmgr: add --version-number command line option (Ian)
repmgr: add --terse option to "cluster show"; GitHub #521 (Ian)
+ repmgr: add --dry-run option to "standby promote"; GitHub #522 (Ian)
repmgrd: check binary and extension major versions match; GitHub #515 (Ian)
4.2.1 2018-??-??
diff --git a/doc/appendix-release-notes.sgml b/doc/appendix-release-notes.sgml
index f674eb09..711269be 100644
--- a/doc/appendix-release-notes.sgml
+++ b/doc/appendix-release-notes.sgml
@@ -35,6 +35,12 @@
+
+
+ Add to repmgr standby promote (GitHub #522).
+
+
+
repmgr --version-number outputs the "raw"
diff --git a/doc/repmgr-standby-promote.sgml b/doc/repmgr-standby-promote.sgml
index ac4d6404..b0598b5b 100644
--- a/doc/repmgr-standby-promote.sgml
+++ b/doc/repmgr-standby-promote.sgml
@@ -35,6 +35,20 @@
+
+ Options
+
+
+
+
+
+ Check if this node can be promoted, but don't carry out the promotion
+
+
+
+
+
+
Example
diff --git a/repmgr-action-standby.c b/repmgr-action-standby.c
index 85980fb7..0bd766c8 100644
--- a/repmgr-action-standby.c
+++ b/repmgr-action-standby.c
@@ -1982,13 +1982,17 @@ do_standby_promote(void)
exit(ERR_DB_CONN);
}
}
+ else if (runtime_options.dry_run == true)
+ {
+ log_info(_("node is a standby"));
+ }
/* check that there's no existing primary */
current_primary_conn = get_primary_connection_quiet(conn, &existing_primary_id, NULL);
if (PQstatus(current_primary_conn) == CONNECTION_OK)
{
- log_error(_("this cluster already has an active primary server"));
+ log_error(_("this replication cluster already has an active primary server"));
if (existing_primary_id != UNKNOWN_NODE_ID)
{
@@ -2005,9 +2009,19 @@ do_standby_promote(void)
PQfinish(conn);
exit(ERR_PROMOTION_FAIL);
}
+ else if (runtime_options.dry_run == true)
+ {
+ log_info(_("no active primary server found in this replication cluster"));
+ }
PQfinish(current_primary_conn);
+ if (runtime_options.dry_run == true)
+ {
+ log_info(_("prerequisites for executing STANDBY PROMOTE are met"));
+ exit(SUCCESS);
+ }
+
_do_standby_promote_internal(conn, server_version_num);
}
diff --git a/repmgr-client.c b/repmgr-client.c
index b34b7987..013fdaf0 100644
--- a/repmgr-client.c
+++ b/repmgr-client.c
@@ -1823,6 +1823,7 @@ check_cli_parameters(const int action)
case STANDBY_REGISTER:
case STANDBY_FOLLOW:
case STANDBY_SWITCHOVER:
+ case STANDBY_PROMOTE:
case WITNESS_REGISTER:
case WITNESS_UNREGISTER:
case NODE_REJOIN: