diff --git a/HISTORY b/HISTORY index 8a006006..e2a2d034 100644 --- a/HISTORY +++ b/HISTORY @@ -1,6 +1,7 @@ 4.4 2019-??-?? repmgr: improve "daemon status" output (Ian) repmgr: add "--siblings-follow" option to "standby promote" (Ian) + repmgr: add "--repmgrd-force-unpause" option to "standby switchover" (Ian) repmgr: improve "--dry-run" behaviour for "standby promote" and "standby switchover" (Ian) repmgrd: monitor standbys attached to primary (Ian) diff --git a/doc/appendix-release-notes.sgml b/doc/appendix-release-notes.sgml index 61cb4548..54bb0cf9 100644 --- a/doc/appendix-release-notes.sgml +++ b/doc/appendix-release-notes.sgml @@ -43,6 +43,15 @@ + + + repmgr standby switchover: + add to unpause all &repmgrd; instances after executing a switchover. + This will ensure that any &repmgrd; instances which were paused before the switchover will be + unpaused. + + + repmgr daemon status: diff --git a/doc/repmgr-standby-switchover.sgml b/doc/repmgr-standby-switchover.sgml index 2b772aed..17d534fe 100644 --- a/doc/repmgr-standby-switchover.sgml +++ b/doc/repmgr-standby-switchover.sgml @@ -142,6 +142,24 @@ This option should not be used unless you take steps by other means to ensure &repmgrd; is paused or not running on all nodes. + + + This option cannot be used together with . + + + + + + + + + + Always unpause all &repmgrd; instances after executing a switchover. This will ensure that + any &repmgrd; instances which were paused before the switchover will be + unpaused. + + + This option cannot be used together with . diff --git a/repmgr-action-standby.c b/repmgr-action-standby.c index fed07e3b..c6ce932d 100644 --- a/repmgr-action-standby.c +++ b/repmgr-action-standby.c @@ -4671,9 +4671,9 @@ do_standby_switchover(void) for (cell = all_nodes.head; cell; cell = cell->next) { - if (repmgrd_info[i]->paused == true) + if (repmgrd_info[i]->paused == true && runtime_options.repmgrd_force_unpause == false) { - log_debug("repmgrd on node \"%s\" (ID %i) paused before switchover, not unpausing", + log_debug("repmgrd on node \"%s\" (ID %i) paused before switchover, --repmgrd-force-unpause not provided, not unpausing", cell->node_info->node_name, cell->node_info->node_id); diff --git a/repmgr-client-global.h b/repmgr-client-global.h index 9998056b..3b5f1a33 100644 --- a/repmgr-client-global.h +++ b/repmgr-client-global.h @@ -101,6 +101,7 @@ typedef struct char force_rewind_path[MAXPGPATH]; bool siblings_follow; bool repmgrd_no_pause; + bool repmgrd_force_unpause; /* "node status" options */ bool is_shutdown_cleanly; @@ -163,7 +164,7 @@ typedef struct /* "standby register" options */ \ false, -1, DEFAULT_WAIT_START, \ /* "standby switchover" options */ \ - false, false, "", false, false, \ + false, false, "", false, false, false, \ /* "node status" options */ \ false, \ /* "node check" options */ \ diff --git a/repmgr-client.c b/repmgr-client.c index b54893c3..58f707da 100644 --- a/repmgr-client.c +++ b/repmgr-client.c @@ -478,6 +478,10 @@ main(int argc, char **argv) runtime_options.repmgrd_no_pause = true; break; + case OPT_REPMGRD_FORCE_UNPAUSE: + runtime_options.repmgrd_force_unpause = true; + break; + /*---------------------- * "node status" options *---------------------- @@ -1858,6 +1862,22 @@ check_cli_parameters(const int action) } } + if (runtime_options.repmgrd_force_unpause == true) + { + switch (action) + { + case STANDBY_SWITCHOVER: + if (runtime_options.repmgrd_no_pause == true) + item_list_append(&cli_errors, + _("--repmgrd-force-unpause and --repmgrd-no-pause cannot be used together")); + break; + default: + item_list_append_format(&cli_warnings, + _("--repmgrd-force-unpause will be ignored when executing %s"), + action_name(action)); + } + } + if (runtime_options.config_files[0] != '\0') { switch (action) diff --git a/repmgr-client.h b/repmgr-client.h index de2d7a97..10d09fac 100644 --- a/repmgr-client.h +++ b/repmgr-client.h @@ -101,6 +101,7 @@ #define OPT_DISABLE_WAL_RECEIVER 1046 #define OPT_ENABLE_WAL_RECEIVER 1047 #define OPT_DETAIL 1048 +#define OPT_REPMGRD_FORCE_UNPAUSE 1049 /* deprecated since 3.3 */ #define OPT_DATA_DIR 999 @@ -173,6 +174,7 @@ static struct option long_options[] = {"always-promote", no_argument, NULL, OPT_ALWAYS_PROMOTE}, {"siblings-follow", no_argument, NULL, OPT_SIBLINGS_FOLLOW}, {"repmgrd-no-pause", no_argument, NULL, OPT_REPMGRD_NO_PAUSE}, + {"repmgrd-force-unpause", no_argument, NULL, OPT_REPMGRD_FORCE_UNPAUSE}, /* "node status" options */ {"is-shutdown-cleanly", no_argument, NULL, OPT_IS_SHUTDOWN_CLEANLY},