"standby switchover": add "--repmgrd-force-unpause"

Implements GitHub #559.
This commit is contained in:
Ian Barwick
2019-05-10 16:00:24 +09:00
parent d43b40c5c6
commit d8e4c54ea4
7 changed files with 54 additions and 3 deletions

View File

@@ -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)

View File

@@ -43,6 +43,15 @@
</note>
</listitem>
<listitem>
<para>
<link linkend="repmgr-standby-switchover"><command>repmgr standby switchover</command></link>:
add <option>--repmgrd-force-unpause</option> 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.
</para>
</listitem>
<listitem>
<para>
<link linkend="repmgr-daemon-status"><command>repmgr daemon status</command></link>:

View File

@@ -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.
</para>
<para>
This option cannot be used together with <option>--repmgrd-force-un/Users/barwick/2ndq/repmgr/doc/repmgr-standby-switchover.sgmlpause</option>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--repmgrd-force-unpause</option></term>
<listitem>
<para>
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.
</para>
<para>
This option cannot be used together with <option>--repmgrd-no-pause</option>.
</para>
</listitem>
</varlistentry>

View File

@@ -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);

View File

@@ -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 */ \

View File

@@ -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)

View File

@@ -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},