1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-17 01:12:23 +02:00

Add --set option to the expire command.

The specified backup set (i.e. the backup label provided and all of its dependent backups, if any) will be expired regardless of backup retention rules except that at least one full backup must remain in the repository.
This commit is contained in:
Cynthia Shang
2020-04-27 14:00:36 -04:00
committed by David Steele
parent ad33f545d1
commit 1c1a710460
11 changed files with 847 additions and 9 deletions

View File

@ -530,6 +530,8 @@ sub run
$oHostDbStandby->clusterStop({bIgnoreLogError => true});
}
my $strAdhocBackup;
# Execute stop and make sure the backup fails
#---------------------------------------------------------------------------------------------------------------------------
# Restart the cluster to check for any errors before continuing since the stop tests will definitely create errors and
@ -538,6 +540,9 @@ sub run
{
$oHostDbMaster->clusterRestart();
# Add backup for adhoc expire
$strAdhocBackup = $oHostBackup->backup(CFGOPTVAL_BACKUP_TYPE_DIFF, 'backup for adhoc expire');
$oHostDbMaster->stop();
$oHostBackup->backup(
@ -630,6 +635,12 @@ sub run
$oHostDbMaster->sqlSelectOne("select pg_start_backup('test backup that will be restarted', true)");
}
if (defined($strAdhocBackup))
{
# Adhoc expire the latest backup - no other tests should be affected
$oHostBackup->expire({strOptionalParam => '--set=' . $strAdhocBackup});
}
# Drop a table
$oHostDbMaster->sqlExecute('drop table test_remove');
$oHostDbMaster->sqlWalRotate();