From 2fa69af8da4075e82359a8585ecde2f2030db546 Mon Sep 17 00:00:00 2001 From: Cynthia Shang Date: Mon, 16 Mar 2020 13:56:52 -0400 Subject: [PATCH] Add --dry-run option to the expire command. Use dry-run to see which backups/archive would be removed by the expire command without actually removing anything. --- build/lib/pgBackRestBuild/Config/Data.pm | 12 + doc/xml/reference.xml | 9 + doc/xml/release.xml | 11 + doc/xml/user-guide.xml | 2 +- src/command/expire/expire.c | 61 ++-- src/config/config.auto.c | 9 + src/config/config.auto.h | 5 +- src/config/define.auto.c | 31 ++ src/config/define.auto.h | 1 + src/config/parse.auto.c | 8 + test/lib/pgBackRestTest/LibCAuto.pm | 354 +++++++++++++++++++++++ test/src/module/command/expireTest.c | 98 ++++++- 12 files changed, 581 insertions(+), 20 deletions(-) create mode 100644 test/lib/pgBackRestTest/LibCAuto.pm diff --git a/build/lib/pgBackRestBuild/Config/Data.pm b/build/lib/pgBackRestBuild/Config/Data.pm index 40185a664..12590905f 100644 --- a/build/lib/pgBackRestBuild/Config/Data.pm +++ b/build/lib/pgBackRestBuild/Config/Data.pm @@ -128,6 +128,8 @@ use constant CFGOPT_CONFIG_INCLUDE_PATH => 'config-i push @EXPORT, qw(CFGOPT_CONFIG_INCLUDE_PATH); use constant CFGOPT_DELTA => 'delta'; push @EXPORT, qw(CFGOPT_DELTA); +use constant CFGOPT_DRYRUN => 'dry-run'; + push @EXPORT, qw(CFGOPT_DRYRUN); use constant CFGOPT_FORCE => 'force'; push @EXPORT, qw(CFGOPT_FORCE); use constant CFGOPT_ONLINE => 'online'; @@ -760,6 +762,16 @@ my %hConfigDefine = &CFGDEF_NEGATE => false, }, + &CFGOPT_DRYRUN => + { + &CFGDEF_TYPE => CFGDEF_TYPE_BOOLEAN, + &CFGDEF_DEFAULT => false, + &CFGDEF_COMMAND => + { + &CFGCMD_EXPIRE => {}, + }, + }, + &CFGOPT_FORCE => { &CFGDEF_TYPE => CFGDEF_TYPE_BOOLEAN, diff --git a/doc/xml/reference.xml b/doc/xml/reference.xml index 1cae3806b..7d8fcd4bf 100644 --- a/doc/xml/reference.xml +++ b/doc/xml/reference.xml @@ -935,6 +935,15 @@ /conf/pgbackrest + + +