1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-11-06 08:49:29 +02:00

Use a constant to check restore target action.

Checking the default here was fragile. If the default were to change the code would break.

This also removes the only dependency on cfgOptionDefault() outside of the help command.
This commit is contained in:
David Steele
2020-11-04 11:09:05 -05:00
parent 021a34a55b
commit d5d1ec6f6f

View File

@@ -40,6 +40,8 @@ Recovery constants
#define RECOVERY_TARGET_XID "recovery_target_xid"
#define RECOVERY_TARGET_ACTION "recovery_target_action"
#define RECOVERY_TARGET_ACTION_PAUSE "pause"
STRING_STATIC(RECOVERY_TARGET_ACTION_PAUSE_STR, RECOVERY_TARGET_ACTION_PAUSE);
#define RECOVERY_TARGET_ACTION_SHUTDOWN "shutdown"
STRING_STATIC(RECOVERY_TARGET_ACTION_SHUTDOWN_STR, RECOVERY_TARGET_ACTION_SHUTDOWN);
@@ -1409,7 +1411,7 @@ restoreRecoveryOption(unsigned int pgVersion)
{
const String *targetAction = cfgOptionStr(cfgOptTargetAction);
if (!strEq(targetAction, varStr(cfgOptionDefault(cfgOptTargetAction))))
if (!strEq(targetAction, RECOVERY_TARGET_ACTION_PAUSE_STR))
{
// Write recovery_target on supported PostgreSQL versions
if (pgVersion >= PG_VERSION_RECOVERY_TARGET_ACTION)