1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-01-30 05:39:12 +02:00

Add time-based retention for full backups.

The --repo-retention-full-type option allows retention of full backups based on a time period, specified in days.

The new option will default to 'count' and therefore will not affect current installations. Setting repo-retention-full-type to 'time' will allow the user to use a time period, in days, to indicate full backup retention. Using this method, a full backup can be expired only if the time the backup completed is older than the number of days set with repo-retention-full (calculated from the moment the 'expire' command is run) and at least one full backup meets the retention period. If archive retention has not been configured, then the default settings will expire archives that are prior to the oldest retained full backup. For example, if there are three full backups ending in times that are 25 days old (F1), 20 days old (F2) and 10 days old (F3), then if the full retention period is 15 days, then only F1 will be expired; F2 will be retained because F1 is not at least 15 days old.
This commit is contained in:
Cynthia Shang 2020-05-08 15:25:03 -04:00 committed by GitHub
parent e873ad6da0
commit cdebfb09e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 572 additions and 103 deletions

View File

@ -197,6 +197,7 @@ use constant CFGOPT_REPO_RETENTION_ARCHIVE => CFGDEF_PR
use constant CFGOPT_REPO_RETENTION_ARCHIVE_TYPE => CFGDEF_PREFIX_REPO . '-retention-archive-type';
use constant CFGOPT_REPO_RETENTION_DIFF => CFGDEF_PREFIX_REPO . '-retention-diff';
use constant CFGOPT_REPO_RETENTION_FULL => CFGDEF_PREFIX_REPO . '-retention-full';
use constant CFGOPT_REPO_RETENTION_FULL_TYPE => CFGDEF_PREFIX_REPO . '-retention-full-type';
# Repository Host
use constant CFGOPT_REPO_HOST => CFGDEF_PREFIX_REPO . '-host';
@ -1705,6 +1706,21 @@ my %hConfigDefine =
{
'retention-full' => {&CFGDEF_INDEX => 1, &CFGDEF_RESET => false},
},
&CFGDEF_COMMAND => CFGOPT_REPO_RETENTION_FULL_TYPE,
},
&CFGOPT_REPO_RETENTION_FULL_TYPE =>
{
&CFGDEF_SECTION => CFGDEF_SECTION_GLOBAL,
&CFGDEF_TYPE => CFGDEF_TYPE_STRING,
&CFGDEF_PREFIX => CFGDEF_PREFIX_REPO,
&CFGDEF_INDEX_TOTAL => CFGDEF_INDEX_REPO,
&CFGDEF_DEFAULT => 'count',
&CFGDEF_ALLOW_LIST =>
[
'count',
'time',
],
&CFGDEF_COMMAND =>
{
&CFGCMD_BACKUP => {},

View File

@ -306,7 +306,7 @@
<b>Indexing</b>: All <setting>repo-</setting> options are indexed to allow for configuring multiple repositories, though only a single repository is currently supported. For example, the repository is configured with the <setting>repo1-path</setting>, <setting>repo1-host</setting>, etc. options.
The <setting>repo-retention-*</setting> options define how long backups will be retained. Expiration only occurs when the number of complete backups exceeds the allowed retention. In other words, if retention-full is set to 2, then there must be 3 complete backups before the oldest will be expired. Make sure you always have enough space for retention + 1 backups.</text>
The <setting>repo-retention-*</setting> options define how long backups will be retained. Expiration only occurs when the count of complete backups exceeds the allowed retention. In other words, if <setting>repo-retention-full-type</setting> is set to <setting>count</setting> (default) and <setting>repo-retention-full</setting> is set to 2, then there must be 3 complete backups before the oldest will be expired. If <setting>repo-retention-full-type</setting> is set to <setting>time</setting> then <setting>repo-retention-full</setting> represents days so there must be at least that many days worth of full backups before expiration can occur. Make sure you always have enough space for retention + 1 backups.</text>
<config-key-list>
<!-- CONFIG - REPO SECTION - REPO-HOST KEY -->
@ -395,15 +395,24 @@
<example>/backup/db/backrest</example>
</config-key>
<!-- CONFIG - RETENTION SECTION - REPO-FULL-RETENTION KEY -->
<!-- CONFIG - RETENTION SECTION - REPO-RETENTION-FULL KEY -->
<config-key id="repo-retention-full" name="Full Retention">
<summary>Number of full backups to retain.</summary>
<summary>Full backup retention count/time.</summary>
<text>When a full backup expires, all differential and incremental backups associated with the full backup will also expire. When the option is not defined a warning will be issued. If indefinite retention is desired then set the option to the max value.</text>
<example>2</example>
</config-key>
<!-- CONFIG - RETENTION SECTION - REPO-RETENTION-FULL-TYPE KEY -->
<config-key id="repo-retention-full-type" name="Full Retention Type">
<summary>Retention type for full backups.</summary>
<text>Determines whether the <setting>repo-retention-full</setting> setting represents a time period (days) or count of full backups to keep. If set to <setting>time</setting> then full backups older than <setting>repo-retention-full</setting> will be removed from the repository if there is at least one backup that is equal to or greater than the <setting>repo-retention-full</setting> setting. For example, if <setting>repo-retention-full</setting> is 30 (days) and there are 2 full backups: one 25 days old and one 35 days old, no full backups will be expired because expiring the 35 day old backup would leave only the 25 day old backup, which would violate the 30 day retention policy of having at least one backup 30 days old before an older one can be expired. Archived WAL older than the oldest full backup remaining will be automatically expired unless <setting>repo-retention-archive-type</setting> and <setting>repo-retention-archive</setting> are explicitly set.</text>
<example>30</example>
</config-key>
<!-- CONFIG - RETENTION SECTION - REPO-DIFFERENTIAL-RETENTION KEY -->
<config-key id="repo-retention-diff" name="Differential Retention">
<summary>Number of differential backups to retain.</summary>
@ -426,7 +435,7 @@
<config-key id="repo-retention-archive" name="Archive Retention">
<summary>Number of backups worth of continuous WAL to retain.</summary>
<text><admonition type="note">WAL segments required to make a backup consistent are always retained until the backup is expired regardless of how this option is configured.</admonition>If this value is not set, then the archive to expire will default to the <setting>repo-retention-full</setting> (or <setting>repo-retention-diff</setting>) value corresponding to the <setting>repo-retention-archive-type</setting> if set to <setting>full</setting> (or <setting>diff</setting>). This will ensure that WAL is only expired for backups that are already expired.
<text><admonition type="note">WAL segments required to make a backup consistent are always retained until the backup is expired regardless of how this option is configured.</admonition>If this value is not set and <setting>repo-retention-full-type</setting> is <setting>count</setting> (default), then the archive to expire will default to the <setting>repo-retention-full</setting> (or <setting>repo-retention-diff</setting>) value corresponding to the <setting>repo-retention-archive-type</setting> if set to <setting>full</setting> (or <setting>diff</setting>). This will ensure that WAL is only expired for backups that are already expired. If <setting>repo-retention-full-type</setting> is <setting>time</setting>, then this value will default to removing archives that are earlier than the oldest full backup retained after satisfying the <setting>repo-retention-full</setting> setting.
This option must be set if <setting>repo-retention-archive-type</setting> is set to <setting>incr</setting>. If disk space is at a premium, then this setting, in conjunction with <setting>repo-retention-archive-type</setting>, can be used to aggressively expire WAL segments. However, doing so negates the ability to perform PITR from the backups with expired WAL and is therefore <b>not</b> recommended.</text>

View File

@ -43,6 +43,17 @@
</release-bug-list>
<release-feature-list>
<release-item>
<release-item-contributor-list>
<release-item-contributor id="cynthia.shang"/>
<release-item-contributor id="pierre.ducroquet"/>
</release-item-contributor-list>
<p>Add time-based retention for full backups.</p>
<p>The <br-option>--repo-retention-full-type</br-option> option allows retention of full backups based on a time period, specified in days.</p>
</release-item>
<release-item>
<release-item-contributor-list>
<release-item-contributor id="cynthia.shang"/>
@ -8455,6 +8466,11 @@
<contributor-id type="github">psuderevsky</contributor-id>
</contributor>
<contributor id="pierre.ducroquet">
<contributor-name-display>Pierre Ducroquet</contributor-name-display>
<contributor-id type="github">PierreDucroquet</contributor-id>
</contributor>
<contributor id="pritam.barhate">
<contributor-name-display>Pritam Barhate</contributor-name-display>
<contributor-id type="github">pritammobisoft</contributor-id>

View File

@ -1483,7 +1483,7 @@
<section id="full">
<title>Full Backup Retention</title>
<p>Set <br-option>repo1-retention-full</br-option> to the number of full backups required. New backups must be completed before expiration will occur &amp;mdash; that means if <br-setting>repo1-retention-full=2</br-setting> then there will be three full backups stored before the oldest one is expired.</p>
<p>The <br-option>repo1-retention-full-type</br-option> determines how the option <br-option>repo1-retention-full</br-option> is interpreted; either as the count of full backups to be retained or how many days to retain full backups. New backups must be completed before expiration will occur &amp;mdash; that means if <br-setting>repo1-retention-full-type=count</br-setting> and <br-setting>repo1-retention-full=2</br-setting> then there will be three full backups stored before the oldest one is expired, or if <br-setting>repo1-retention-full-type=time</br-setting> and <br-setting>repo1-retention-full=20</br-setting> then there must be one full backup that is at least 20 days old before expiration can occur.</p>
<backrest-config host="{[host-pg1]}" file="{[backrest-config-demo]}">
<title>Configure <br-option>repo1-retention-full</br-option></title>

View File

@ -6,6 +6,7 @@ Expire Command
#include "command/archive/common.h"
#include "command/backup/common.h"
#include "command/control/common.h"
#include "common/time.h"
#include "common/type/list.h"
#include "common/debug.h"
#include "common/regExp.h"
@ -17,7 +18,6 @@ Expire Command
#include "storage/helper.h"
#include <stdlib.h>
#include <stdio.h>
/***********************************************************************************************************************************
Helper functions and structures
@ -286,6 +286,80 @@ expireFullBackup(InfoBackup *infoBackup)
FUNCTION_LOG_RETURN(UINT, result);
}
/***********************************************************************************************************************************
Expire backups based on time
***********************************************************************************************************************************/
static unsigned int
expireTimeBasedBackup(InfoBackup *infoBackup, const time_t minTimestamp)
{
FUNCTION_LOG_BEGIN(logLevelDebug);
FUNCTION_LOG_PARAM(INFO_BACKUP, infoBackup);
FUNCTION_LOG_PARAM(TIME, minTimestamp);
FUNCTION_LOG_END();
ASSERT(infoBackup != NULL);
ASSERT(minTimestamp > 0);
unsigned int result = 0;
MEM_CONTEXT_TEMP_BEGIN()
{
// Get the list of full backups
StringList *currentBackupList = strLstSort(infoBackupDataLabelList(infoBackup, backupRegExpP(.full = true)), sortOrderAsc);
unsigned int backupIdx = strLstSize(currentBackupList);
// Find out the point where we will have to stop purging backups. Starting with the newest backup (the end of the list),
// find the first backup that is older than the expire time period by checking the backup stop time. This way, if the
// backups are F1 D1a D1b D1c F2 D2a D2b F3 D3a D3b and the expiration time period is at D2b, then purge only F1, D1a, D1b
// and D1c, and keep the next full backups (F2 and F3) and all intermediate non-full backups.
if (backupIdx > 0)
{
const String *lastBackupLabelToKeep = NULL;
do
{
backupIdx--;
InfoBackupData *info = infoBackupDataByLabel(infoBackup, strLstGet(currentBackupList, backupIdx));
lastBackupLabelToKeep = info->backupLabel;
// We can start deleting before this backup. This way, we keep one full backup and its dependents.
if (info->backupTimestampStop < minTimestamp)
break;
}
while (backupIdx != 0);
// Count number of full backups being expired
unsigned int numFullExpired = 0;
// Since expireBackup will remove the requested entry from the backup list, we keep checking the first entry which is
// always the oldest so if it is not the backup to keep then we can remove it
while (!strEq(infoBackupData(infoBackup, 0).backupLabel, lastBackupLabelToKeep))
{
StringList *backupExpired = expireBackup(infoBackup, infoBackupData(infoBackup, 0).backupLabel);
result += strLstSize(backupExpired);
numFullExpired++;
// Log the expired backups. If there is more than one backup, then prepend "set:"
LOG_INFO_FMT(
"expire time-based backup %s%s", (strLstSize(backupExpired) > 1 ? "set: " : ""),
strPtr(strLstJoin(backupExpired, ", ")));
}
if (strEqZ(cfgOptionStr(cfgOptRepoRetentionArchiveType), CFGOPTVAL_TMP_REPO_RETENTION_ARCHIVE_TYPE_FULL) &&
!cfgOptionTest(cfgOptRepoRetentionArchive) && numFullExpired > 0)
{
cfgOptionSet(
cfgOptRepoRetentionArchive, cfgSourceDefault, varNewUInt(strLstSize(currentBackupList) - numFullExpired));
}
}
}
MEM_CONTEXT_TEMP_END();
FUNCTION_LOG_RETURN(UINT, result);
}
/***********************************************************************************************************************************
Log detailed information about archive logs removed
***********************************************************************************************************************************/
@ -307,10 +381,11 @@ logExpire(ArchiveExpired *archiveExpire, String *archiveId)
Process archive retention
***********************************************************************************************************************************/
static void
removeExpiredArchive(InfoBackup *infoBackup)
removeExpiredArchive(InfoBackup *infoBackup, bool timeBasedFullRetention)
{
FUNCTION_LOG_BEGIN(logLevelDebug);
FUNCTION_LOG_PARAM(INFO_BACKUP, infoBackup);
FUNCTION_LOG_PARAM(BOOL, timeBasedFullRetention);
FUNCTION_LOG_END();
ASSERT(infoBackup != NULL);
@ -325,7 +400,13 @@ removeExpiredArchive(InfoBackup *infoBackup)
// cfgLoadUpdateOption based on certain rules.
if (archiveRetention == 0)
{
LOG_INFO_FMT("option '%s' is not set - archive logs will not be expired", cfgOptionName(cfgOptRepoRetentionArchive));
String *msg = strNew("- archive logs will not be expired");
// Only notify user if not time-based retention
if (!timeBasedFullRetention)
LOG_INFO_FMT("option '%s' is not set %s", cfgOptionName(cfgOptRepoRetentionArchive), strPtr(msg));
else
LOG_INFO_FMT("time-based archive retention not met %s", strPtr(msg));
}
else
{
@ -764,16 +845,28 @@ cmdExpire(void)
cfgOptionStrNull(cfgOptRepoCipherPass));
const String *adhocBackupLabel = NULL;
bool timeBasedFullRetention = strEqZ(
cfgOptionStr(cfgOptRepoRetentionFullType), CFGOPTVAL_TMP_REPO_RETENTION_FULL_TYPE_TIME);
// If the --set option is valid (i.e. expire is called on its own) and is set then attempt to expire the requested backup
if (cfgOptionValid(cfgOptSet) && cfgOptionTest(cfgOptSet))
if (cfgOptionTest(cfgOptSet))
{
adhocBackupLabel = cfgOptionStr(cfgOptSet);
expireAdhocBackup(infoBackup, adhocBackupLabel);
}
else
{
expireFullBackup(infoBackup);
// If time-based retention for full backups is set, then expire based on time period
if (timeBasedFullRetention)
{
// If a time period was provided then run time-based expiration otherwise do nothing (the user has already been
// warned by the config system that retention-full was not set)
if (cfgOptionTest(cfgOptRepoRetentionFull))
expireTimeBasedBackup(infoBackup, time(NULL) - (time_t)(cfgOptionUInt(cfgOptRepoRetentionFull) * SEC_PER_DAY));
}
else
expireFullBackup(infoBackup);
expireDiffBackup(infoBackup);
}
@ -787,7 +880,7 @@ cmdExpire(void)
// Remove all files on disk that are now expired
removeExpiredBackup(infoBackup, adhocBackupLabel);
removeExpiredArchive(infoBackup);
removeExpiredArchive(infoBackup, timeBasedFullRetention);
}
MEM_CONTEXT_TEMP_END();

View File

@ -16,6 +16,7 @@ typedef uint64_t TimeMSec;
Constants describing number of sub-units in an interval
***********************************************************************************************************************************/
#define MSEC_PER_SEC ((TimeMSec)1000)
#define SEC_PER_DAY ((time_t)86400)
/***********************************************************************************************************************************
Functions

View File

@ -434,6 +434,7 @@ STRING_EXTERN(CFGOPT_REPO1_RETENTION_ARCHIVE_STR, CFGOPT_REPO1
STRING_EXTERN(CFGOPT_REPO1_RETENTION_ARCHIVE_TYPE_STR, CFGOPT_REPO1_RETENTION_ARCHIVE_TYPE);
STRING_EXTERN(CFGOPT_REPO1_RETENTION_DIFF_STR, CFGOPT_REPO1_RETENTION_DIFF);
STRING_EXTERN(CFGOPT_REPO1_RETENTION_FULL_STR, CFGOPT_REPO1_RETENTION_FULL);
STRING_EXTERN(CFGOPT_REPO1_RETENTION_FULL_TYPE_STR, CFGOPT_REPO1_RETENTION_FULL_TYPE);
STRING_EXTERN(CFGOPT_REPO1_S3_BUCKET_STR, CFGOPT_REPO1_S3_BUCKET);
STRING_EXTERN(CFGOPT_REPO1_S3_CA_FILE_STR, CFGOPT_REPO1_S3_CA_FILE);
STRING_EXTERN(CFGOPT_REPO1_S3_CA_PATH_STR, CFGOPT_REPO1_S3_CA_PATH);
@ -1680,6 +1681,14 @@ static ConfigOptionData configOptionData[CFG_OPTION_TOTAL] = CONFIG_OPTION_LIST
CONFIG_OPTION_DEFINE_ID(cfgDefOptRepoRetentionFull)
)
//------------------------------------------------------------------------------------------------------------------------------
CONFIG_OPTION
(
CONFIG_OPTION_NAME(CFGOPT_REPO1_RETENTION_FULL_TYPE)
CONFIG_OPTION_INDEX(0)
CONFIG_OPTION_DEFINE_ID(cfgDefOptRepoRetentionFullType)
)
//------------------------------------------------------------------------------------------------------------------------------
CONFIG_OPTION
(

View File

@ -355,6 +355,8 @@ Option constants
STRING_DECLARE(CFGOPT_REPO1_RETENTION_DIFF_STR);
#define CFGOPT_REPO1_RETENTION_FULL "repo1-retention-full"
STRING_DECLARE(CFGOPT_REPO1_RETENTION_FULL_STR);
#define CFGOPT_REPO1_RETENTION_FULL_TYPE "repo1-retention-full-type"
STRING_DECLARE(CFGOPT_REPO1_RETENTION_FULL_TYPE_STR);
#define CFGOPT_REPO1_S3_BUCKET "repo1-s3-bucket"
STRING_DECLARE(CFGOPT_REPO1_S3_BUCKET_STR);
#define CFGOPT_REPO1_S3_CA_FILE "repo1-s3-ca-file"
@ -420,7 +422,7 @@ Option constants
#define CFGOPT_TYPE "type"
STRING_DECLARE(CFGOPT_TYPE_STR);
#define CFG_OPTION_TOTAL 183
#define CFG_OPTION_TOTAL 184
/***********************************************************************************************************************************
Command enum
@ -605,6 +607,7 @@ typedef enum
cfgOptRepoRetentionArchiveType,
cfgOptRepoRetentionDiff,
cfgOptRepoRetentionFull,
cfgOptRepoRetentionFullType,
cfgOptRepoS3Bucket,
cfgOptRepoS3CaFile,
cfgOptRepoS3CaPath,

View File

@ -50,6 +50,9 @@ Constants for configuration options.
#define CFGOPTVAL_TMP_REPO_RETENTION_ARCHIVE_TYPE_FULL "full"
#define CFGOPTVAL_TMP_REPO_RETENTION_ARCHIVE_TYPE_INCR "incr"
#define CFGOPTVAL_TMP_REPO_RETENTION_FULL_TYPE_COUNT "count"
#define CFGOPTVAL_TMP_REPO_RETENTION_FULL_TYPE_TIME "time"
/***********************************************************************************************************************************
Command Functions

View File

@ -3404,9 +3404,11 @@ static ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
"NOTE: WAL segments required to make a backup consistent are always retained until the backup is expired regardless of "
"how this option is configured.\n"
"\n"
"If this value is not set, then the archive to expire will default to the repo-retention-full (or repo-retention-diff) "
"value corresponding to the repo-retention-archive-type if set to full (or diff). This will ensure that WAL is "
"only expired for backups that are already expired.\n"
"If this value is not set and repo-retention-full-type is count (default), then the archive to expire will default to "
"the repo-retention-full (or repo-retention-diff) value corresponding to the repo-retention-archive-type if set to "
"full (or diff). This will ensure that WAL is only expired for backups that are already expired. If "
"repo-retention-full-type is time, then this value will default to removing archives that are earlier than the "
"oldest full backup retained after satisfying the repo-retention-full setting.\n"
"\n"
"This option must be set if repo-retention-archive-type is set to incr. If disk space is at a premium, then this "
"setting, in conjunction with repo-retention-archive-type, can be used to aggressively expire WAL segments. "
@ -3521,7 +3523,7 @@ static ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_HELP_SECTION("repository")
CFGDEFDATA_OPTION_HELP_SUMMARY("Number of full backups to retain.")
CFGDEFDATA_OPTION_HELP_SUMMARY("Full backup retention count/time.")
CFGDEFDATA_OPTION_HELP_DESCRIPTION
(
"When a full backup expires, all differential and incremental backups associated with the full backup will also "
@ -3543,6 +3545,51 @@ static ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
)
)
// -----------------------------------------------------------------------------------------------------------------------------
CFGDEFDATA_OPTION
(
CFGDEFDATA_OPTION_NAME("repo-retention-full-type")
CFGDEFDATA_OPTION_REQUIRED(true)
CFGDEFDATA_OPTION_SECTION(cfgDefSectionGlobal)
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString)
CFGDEFDATA_OPTION_INTERNAL(false)
CFGDEFDATA_OPTION_INDEX_TOTAL(1)
CFGDEFDATA_OPTION_SECURE(false)
CFGDEFDATA_OPTION_HELP_SECTION("repository")
CFGDEFDATA_OPTION_HELP_SUMMARY("Retention type for full backups.")
CFGDEFDATA_OPTION_HELP_DESCRIPTION
(
"Determines whether the repo-retention-full setting represents a time period (days) or count of full backups to keep. "
"If set to time then full backups older than repo-retention-full will be removed from the repository if there is "
"at least one backup that is equal to or greater than the repo-retention-full setting. For example, if "
"repo-retention-full is 30 (days) and there are 2 full backups: one 25 days old and one 35 days old, no full "
"backups will be expired because expiring the 35 day old backup would leave only the 25 day old backup, which "
"would violate the 30 day retention policy of having at least one backup 30 days old before an older one can be "
"expired. Archived WAL older than the oldest full backup remaining will be automatically expired unless "
"repo-retention-archive-type and repo-retention-archive are explicitly set."
)
CFGDEFDATA_OPTION_COMMAND_LIST
(
CFGDEFDATA_OPTION_COMMAND(cfgDefCmdBackup)
CFGDEFDATA_OPTION_COMMAND(cfgDefCmdExpire)
)
CFGDEFDATA_OPTION_OPTIONAL_LIST
(
CFGDEFDATA_OPTION_OPTIONAL_ALLOW_LIST
(
"count",
"time"
)
CFGDEFDATA_OPTION_OPTIONAL_DEFAULT("count")
CFGDEFDATA_OPTION_OPTIONAL_PREFIX("repo")
)
)
// -----------------------------------------------------------------------------------------------------------------------------
CFGDEFDATA_OPTION
(

View File

@ -126,6 +126,7 @@ typedef enum
cfgDefOptRepoRetentionArchiveType,
cfgDefOptRepoRetentionDiff,
cfgDefOptRepoRetentionFull,
cfgDefOptRepoRetentionFullType,
cfgDefOptRepoS3Bucket,
cfgDefOptRepoS3CaFile,
cfgDefOptRepoS3CaPath,

View File

@ -135,17 +135,18 @@ cfgLoadUpdateOption(void)
}
// Warn when repo-retention-full is not set on a configured repo
if (!cfgCommandHelp() && cfgOptionValid(cfgOptRepoRetentionFull) && cfgCommandRole() == cfgCmdRoleDefault)
if (!cfgCommandHelp() && cfgOptionValid(cfgOptRepoRetentionFullType) && cfgCommandRole() == cfgCmdRoleDefault)
{
for (unsigned int optionIdx = 0; optionIdx < cfgOptionIndexTotal(cfgOptRepoType); optionIdx++)
{
// If the repo-type is defined, then see if corresponding retention-full is set
if (cfgOptionTest(cfgOptRepoType + optionIdx) && !cfgOptionTest(cfgOptRepoRetentionFull + optionIdx))
if (cfgOptionTest(cfgOptRepoType + optionIdx) && !(cfgOptionTest(cfgOptRepoRetentionFull + optionIdx)))
{
LOG_WARN_FMT(
"option %s is not set, the repository may run out of space"
"\nHINT: to retain full backups indefinitely (without warning), set option '%s' to the maximum.",
cfgOptionName(cfgOptRepoRetentionFull + optionIdx),
"option '%s' is not set for '%s=%s', the repository may run out of space"
"\nHINT: to retain full backups indefinitely (without warning), set option '%s' to the maximum.",
cfgOptionName(cfgOptRepoRetentionFull + optionIdx), cfgOptionName(cfgOptRepoRetentionFullType + optionIdx),
strPtr(cfgOptionStr(cfgOptRepoRetentionFullType + optionIdx)),
cfgOptionName(cfgOptRepoRetentionFull + optionIdx));
}
}
@ -166,11 +167,13 @@ cfgLoadUpdateOption(void)
// If the archive retention is not explicitly set then determine what it should be defaulted to
if (!cfgOptionTest(cfgOptRepoRetentionArchive + optionIdx))
{
// If repo-retention-archive-type is default, then if repo-retention-full is set, set the repo-retention-archive
// to this value, else ignore archiving
// If repo-retention-archive-type is default (full), then if repo-retention-full is set, set the
// repo-retention-archive to this value when retention-full-type is 'count', else ignore archiving. If
// retention-full-type is 'time' then the the expire command will default the archive retention accordingly.
if (strEqZ(archiveRetentionType, CFGOPTVAL_TMP_REPO_RETENTION_ARCHIVE_TYPE_FULL))
{
if (cfgOptionTest(cfgOptRepoRetentionFull + optionIdx))
if (strEqZ(cfgOptionStr(cfgOptRepoRetentionFullType + optionIdx), CFGOPTVAL_TMP_REPO_RETENTION_FULL_TYPE_COUNT)
&& cfgOptionTest(cfgOptRepoRetentionFull + optionIdx))
{
cfgOptionSet(cfgOptRepoRetentionArchive + optionIdx, cfgSourceDefault,
VARUINT(cfgOptionUInt(cfgOptRepoRetentionFull + optionIdx)));

View File

@ -2005,6 +2005,18 @@ static const struct option optionList[] =
.val = PARSE_OPTION_FLAG | PARSE_DEPRECATE_FLAG | cfgOptRepoRetentionFull,
},
// repo-retention-full-type option
// -----------------------------------------------------------------------------------------------------------------------------
{
.name = CFGOPT_REPO1_RETENTION_FULL_TYPE,
.has_arg = required_argument,
.val = PARSE_OPTION_FLAG | cfgOptRepoRetentionFullType,
},
{
.name = "reset-" CFGOPT_REPO1_RETENTION_FULL_TYPE,
.val = PARSE_OPTION_FLAG | PARSE_RESET_FLAG | cfgOptRepoRetentionFullType,
},
// repo-s3-bucket option and deprecations
// -----------------------------------------------------------------------------------------------------------------------------
{
@ -2592,6 +2604,7 @@ static const ConfigOption optionResolveOrder[] =
cfgOptRepoRetentionArchiveType,
cfgOptRepoRetentionDiff,
cfgOptRepoRetentionFull,
cfgOptRepoRetentionFullType,
cfgOptRepoType,
cfgOptResume,
cfgOptSckBlock,

View File

@ -613,7 +613,7 @@ unit:
# ----------------------------------------------------------------------------------------------------------------------------
- name: expire
total: 8
total: 9
coverage:
command/expire/expire: full

View File

@ -59,7 +59,7 @@ full backup - create pg_stat link, pg_clog dir (db-master host)
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --no-online --manifest-save-threshold=3 --buffer-size=[BUFFER-SIZE] --checksum-page --process-max=1 --repo1-type=cifs --type=full --stanza=db backup
------------------------------------------------------------------------------------------------------------------------------------
P00 INFO: backup command begin [BACKREST-VERSION]: --buffer-size=[BUFFER-SIZE] --checksum-page --compress-level=3 --compress-type=none --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=[LOG-LEVEL-FILE] --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log[] --no-log-timestamp --manifest-save-threshold=3 --no-online --pg1-path=[TEST_PATH]/db-master/db/base --process-max=1 --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-master/repo --repo1-type=cifs --stanza=db --start-fast --type=full
P00 WARN: option repo1-retention-full is not set, the repository may run out of space
P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out of space
HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum.
P01 INFO: backup file [TEST_PATH]/db-master/db/base/base/32768/33001 (64KB, 33%) checksum 6bf316f11d28c28914ea9be92c00de9bea6d9a6b
P00 WARN: invalid page checksums found in file [TEST_PATH]/db-master/db/base/base/32768/33001 at pages 0, 3-5, 7
@ -241,7 +241,7 @@ full backup - global stop (db-master host)
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --no-online --type=full --stanza=db backup
------------------------------------------------------------------------------------------------------------------------------------
P00 INFO: backup command begin [BACKREST-VERSION]: --buffer-size=[BUFFER-SIZE] --compress-level=3 --compress-type=none --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=[LOG-LEVEL-FILE] --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log[] --no-log-timestamp --no-online --pg1-path=[TEST_PATH]/db-master/db/base --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-master/repo --stanza=db --start-fast --type=full
P00 WARN: option repo1-retention-full is not set, the repository may run out of space
P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out of space
HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum.
P00 ERROR: [062]: stop file exists for all stanzas
P00 INFO: backup command end: aborted with exception [062]
@ -263,7 +263,7 @@ full backup - stanza stop (db-master host)
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --no-online --type=full --stanza=db backup
------------------------------------------------------------------------------------------------------------------------------------
P00 INFO: backup command begin [BACKREST-VERSION]: --buffer-size=[BUFFER-SIZE] --compress-level=3 --compress-type=none --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=[LOG-LEVEL-FILE] --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log[] --no-log-timestamp --no-online --pg1-path=[TEST_PATH]/db-master/db/base --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-master/repo --stanza=db --start-fast --type=full
P00 WARN: option repo1-retention-full is not set, the repository may run out of space
P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out of space
HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum.
P00 ERROR: [062]: stop file exists for stanza db
P00 INFO: backup command end: aborted with exception [062]
@ -291,7 +291,7 @@ full backup - resume (db-master host)
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --no-online --force --checksum-page --delta --type=full --stanza=db backup
------------------------------------------------------------------------------------------------------------------------------------
P00 INFO: backup command begin [BACKREST-VERSION]: --buffer-size=[BUFFER-SIZE] --checksum-page --compress-level=3 --compress-type=none --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --delta --exclude=postgresql.auto.conf --exclude=pg_log/ --exclude=pg_log2 --exclude=apipe --force --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=[LOG-LEVEL-FILE] --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log[] --no-log-timestamp --no-online --pg1-path=[TEST_PATH]/db-master/db/base --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-master/repo --stanza=db --start-fast --type=full
P00 WARN: option repo1-retention-full is not set, the repository may run out of space
P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out of space
HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum.
P00 WARN: backup '[BACKUP-FULL-1]' missing manifest removed from backup.info
P00 WARN: --no-online passed and postmaster.pid exists but --force was passed so backup will continue though it looks like the postmaster is running and the backup will probably not be consistent
@ -757,7 +757,7 @@ incr backup - add tablespace 1 (db-master host)
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --no-online --stanza=db backup
------------------------------------------------------------------------------------------------------------------------------------
P00 INFO: backup command begin [BACKREST-VERSION]: --buffer-size=[BUFFER-SIZE] --compress-level=3 --compress-type=none --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=[LOG-LEVEL-FILE] --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log[] --no-log-timestamp --no-online --pg1-path=[TEST_PATH]/db-master/db/base --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-master/repo --stanza=db --start-fast
P00 WARN: option repo1-retention-full is not set, the repository may run out of space
P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out of space
HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum.
P00 INFO: last backup label = [BACKUP-FULL-2], version = [VERSION-1]
P00 WARN: incr backup cannot alter 'checksum-page' option to 'false', reset to 'true' from [BACKUP-FULL-2]
@ -949,7 +949,7 @@ incr backup - resume and add tablespace 2 (db-master host)
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --no-online --process-max=1 --delta --stanza=db backup
------------------------------------------------------------------------------------------------------------------------------------
P00 INFO: backup command begin [BACKREST-VERSION]: --buffer-size=[BUFFER-SIZE] --compress-level=3 --compress-type=none --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --delta --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=[LOG-LEVEL-FILE] --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log[] --no-log-timestamp --no-online --pg1-path=[TEST_PATH]/db-master/db/base --process-max=1 --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-master/repo --stanza=db --start-fast
P00 WARN: option repo1-retention-full is not set, the repository may run out of space
P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out of space
HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum.
P00 WARN: backup '[BACKUP-INCR-1]' missing manifest removed from backup.info
P00 INFO: last backup label = [BACKUP-FULL-2], version = [VERSION-1]
@ -1173,7 +1173,7 @@ diff backup - drop tablespace 11 (db-master host)
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --no-online --process-max=1 --delta --type=diff --stanza=db backup
------------------------------------------------------------------------------------------------------------------------------------
P00 INFO: backup command begin [BACKREST-VERSION]: --buffer-size=[BUFFER-SIZE] --compress-level=3 --compress-type=none --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --delta --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=[LOG-LEVEL-FILE] --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log[] --no-log-timestamp --no-online --pg1-path=[TEST_PATH]/db-master/db/base --process-max=1 --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-master/repo --stanza=db --start-fast --type=diff
P00 WARN: option repo1-retention-full is not set, the repository may run out of space
P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out of space
HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum.
P00 INFO: last backup label = [BACKUP-FULL-2], version = [VERSION-1]
P00 WARN: diff backup cannot alter 'checksum-page' option to 'false', reset to 'true' from [BACKUP-FULL-2]
@ -1540,7 +1540,7 @@ incr backup - add files and remove tablespace 2 (db-master host)
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --no-online --process-max=1 --stanza=db backup
------------------------------------------------------------------------------------------------------------------------------------
P00 INFO: backup command begin [BACKREST-VERSION]: --buffer-size=[BUFFER-SIZE] --compress-level=3 --compress-type=none --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=[LOG-LEVEL-FILE] --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log[] --no-log-timestamp --no-online --pg1-path=[TEST_PATH]/db-master/db/base-2 --process-max=1 --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-master/repo --stanza=db --start-fast
P00 WARN: option repo1-retention-full is not set, the repository may run out of space
P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out of space
HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum.
P00 INFO: last backup label = [BACKUP-DIFF-1], version = 0.00
P00 WARN: incr backup cannot alter 'checksum-page' option to 'false', reset to 'true' from [BACKUP-DIFF-1]
@ -1740,7 +1740,7 @@ incr backup - update files (db-master host)
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --no-online --stanza=db backup
------------------------------------------------------------------------------------------------------------------------------------
P00 INFO: backup command begin [BACKREST-VERSION]: --buffer-size=[BUFFER-SIZE] --compress-level=3 --compress-type=none --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=[LOG-LEVEL-FILE] --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log[] --no-log-timestamp --no-online --pg1-path=[TEST_PATH]/db-master/db/base-2 --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-master/repo --stanza=db --start-fast
P00 WARN: option repo1-retention-full is not set, the repository may run out of space
P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out of space
HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum.
P00 INFO: last backup label = [BACKUP-INCR-3], version = [VERSION-1]
P00 WARN: incr backup cannot alter 'checksum-page' option to 'false', reset to 'true' from [BACKUP-INCR-3]
@ -1960,7 +1960,7 @@ diff backup - updates since last full (db-master host)
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --no-online --process-max=1 --delta --type=diff --stanza=db backup
------------------------------------------------------------------------------------------------------------------------------------
P00 INFO: backup command begin [BACKREST-VERSION]: --buffer-size=[BUFFER-SIZE] --compress-level=3 --compress-type=none --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --delta --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=[LOG-LEVEL-FILE] --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log[] --no-log-timestamp --no-online --pg1-path=[TEST_PATH]/db-master/db/base-2 --process-max=1 --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-master/repo --stanza=db --start-fast --type=diff
P00 WARN: option repo1-retention-full is not set, the repository may run out of space
P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out of space
HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum.
P00 INFO: last backup label = [BACKUP-FULL-2], version = [VERSION-1]
P00 WARN: diff backup cannot alter 'checksum-page' option to 'false', reset to 'true' from [BACKUP-FULL-2]
@ -2177,7 +2177,7 @@ diff backup - remove files (db-master host)
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --no-online --process-max=1 --delta --type=diff --stanza=db backup
------------------------------------------------------------------------------------------------------------------------------------
P00 INFO: backup command begin [BACKREST-VERSION]: --buffer-size=[BUFFER-SIZE] --compress-level=3 --compress-type=zst --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --delta --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=[LOG-LEVEL-FILE] --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log[] --no-log-timestamp --no-online --pg1-path=[TEST_PATH]/db-master/db/base-2 --process-max=1 --protocol-timeout=60 --repo1-hardlink --repo1-path=[TEST_PATH]/db-master/repo --stanza=db --start-fast --type=diff
P00 WARN: option repo1-retention-full is not set, the repository may run out of space
P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out of space
HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum.
P00 INFO: last backup label = [BACKUP-FULL-2], version = [VERSION-1]
P00 WARN: diff backup cannot alter compress-type option to 'zst', reset to value in [BACKUP-FULL-2]
@ -2393,7 +2393,7 @@ full backup - update file (db-master host)
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --no-online --type=full --stanza=db backup
------------------------------------------------------------------------------------------------------------------------------------
P00 INFO: backup command begin [BACKREST-VERSION]: --buffer-size=[BUFFER-SIZE] --compress-level=3 --compress-type=zst --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=[LOG-LEVEL-FILE] --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log[] --no-log-timestamp --no-online --pg1-path=[TEST_PATH]/db-master/db/base-2 --protocol-timeout=60 --repo1-hardlink --repo1-path=[TEST_PATH]/db-master/repo --stanza=db --start-fast --type=full
P00 WARN: option repo1-retention-full is not set, the repository may run out of space
P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out of space
HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum.
P01 INFO: backup file [TEST_PATH]/db-master/db/base-2/base/32768/33001 (64KB, 36%) checksum 6bf316f11d28c28914ea9be92c00de9bea6d9a6b
P01 INFO: backup file [TEST_PATH]/db-master/db/base-2/base/32768/44000_init (32KB, 54%) checksum 7a16d165e4775f7c92e8cdf60c0af57313f0bf90
@ -2606,7 +2606,7 @@ diff backup - add file (db-master host)
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --no-online --checksum-page --type=diff --stanza=db backup
------------------------------------------------------------------------------------------------------------------------------------
P00 INFO: backup command begin [BACKREST-VERSION]: --buffer-size=[BUFFER-SIZE] --checksum-page --compress-level=3 --compress-type=zst --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=[LOG-LEVEL-FILE] --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log[] --no-log-timestamp --no-online --pg1-path=[TEST_PATH]/db-master/db/base-2 --protocol-timeout=60 --repo1-hardlink --repo1-path=[TEST_PATH]/db-master/repo --stanza=db --start-fast --type=diff
P00 WARN: option repo1-retention-full is not set, the repository may run out of space
P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out of space
HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum.
P00 INFO: last backup label = [BACKUP-FULL-3], version = [VERSION-1]
P01 INFO: backup file [TEST_PATH]/db-master/db/base-2/base/base2.txt (9B, 100%) checksum cafac3c59553f2cfde41ce2e62e7662295f108c0
@ -3038,7 +3038,7 @@ diff backup - option backup-standby reset - backup performed from master (db-mas
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --no-online --log-level-console=info --backup-standby --type=diff --stanza=db backup
------------------------------------------------------------------------------------------------------------------------------------
P00 INFO: backup command begin [BACKREST-VERSION]: --backup-standby --buffer-size=[BUFFER-SIZE] --compress-level=3 --compress-type=zst --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --lock-path=[TEST_PATH]/db-master/lock --log-level-console=info --log-level-file=[LOG-LEVEL-FILE] --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log[] --no-log-timestamp --no-online --pg1-path=[TEST_PATH]/db-master/db/base-2/base --protocol-timeout=60 --repo1-hardlink --repo1-path=[TEST_PATH]/db-master/repo --stanza=db --start-fast --type=diff
P00 WARN: option repo1-retention-full is not set, the repository may run out of space
P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out of space
HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum.
P00 WARN: option backup-standby is enabled but backup is offline - backups will be performed from the primary
P00 INFO: last backup label = [BACKUP-FULL-3], version = [VERSION-1]

View File

@ -50,7 +50,7 @@ backrest-checksum="[CHECKSUM]"
full backup - create pg_stat link, pg_clog dir (backup host)
> [CONTAINER-EXEC] backup [BACKREST-BIN] --config=[TEST_PATH]/backup/pgbackrest.conf --no-online --manifest-save-threshold=3 --cmd-ssh=/usr/bin/ssh --pg1-port=9999 --pg1-socket-path=/test_socket_path --buffer-size=[BUFFER-SIZE] --checksum-page --process-max=1 --type=full --stanza=db backup
------------------------------------------------------------------------------------------------------------------------------------
P00 WARN: option repo1-retention-full is not set, the repository may run out of space
P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out of space
HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum.
P00 WARN: invalid page checksums found in file db-master:[TEST_PATH]/db-master/db/base/base/32768/33001 at pages 0, 3-5, 7
P00 WARN: invalid page checksum found in file db-master:[TEST_PATH]/db-master/db/base/base/16384/17000 at page 1
@ -242,7 +242,7 @@ backrest-checksum="[CHECKSUM]"
full backup - resume (backup host)
> [CONTAINER-EXEC] backup [BACKREST-BIN] --config=[TEST_PATH]/backup/pgbackrest.conf --no-online --force --checksum-page --type=full --stanza=db backup
------------------------------------------------------------------------------------------------------------------------------------
P00 WARN: option repo1-retention-full is not set, the repository may run out of space
P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out of space
HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum.
P00 WARN: backup '[BACKUP-FULL-1]' missing manifest removed from backup.info
P00 WARN: --no-online passed and postmaster.pid exists but --force was passed so backup will continue though it looks like the postmaster is running and the backup will probably not be consistent
@ -475,7 +475,7 @@ restore_command = '[BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf
incr backup - add tablespace 1 (backup host)
> [CONTAINER-EXEC] backup [BACKREST-BIN] --config=[TEST_PATH]/backup/pgbackrest.conf --no-online --stanza=db backup
------------------------------------------------------------------------------------------------------------------------------------
P00 WARN: option repo1-retention-full is not set, the repository may run out of space
P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out of space
HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum.
P00 WARN: incr backup cannot alter 'checksum-page' option to 'false', reset to 'true' from [BACKUP-FULL-2]
P00 WARN: page misalignment in file db-master:[TEST_PATH]/db-master/db/base/pg_tblspc/1/[TS_PATH-1]/16384/tablespace1.txt: file size 7 is not divisible by page size 8192
@ -676,7 +676,7 @@ backrest-checksum="[CHECKSUM]"
incr backup - resume and add tablespace 2 (backup host)
> [CONTAINER-EXEC] backup [BACKREST-BIN] --config=[TEST_PATH]/backup/pgbackrest.conf --no-online --process-max=1 --stanza=db backup
------------------------------------------------------------------------------------------------------------------------------------
P00 WARN: option repo1-retention-full is not set, the repository may run out of space
P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out of space
HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum.
P00 WARN: backup '[BACKUP-INCR-1]' missing manifest removed from backup.info
P00 WARN: incr backup cannot alter 'checksum-page' option to 'false', reset to 'true' from [BACKUP-FULL-2]
@ -891,7 +891,7 @@ backrest-checksum="[CHECKSUM]"
diff backup - drop tablespace 11 (backup host)
> [CONTAINER-EXEC] backup [BACKREST-BIN] --config=[TEST_PATH]/backup/pgbackrest.conf --no-online --process-max=1 --type=diff --stanza=db backup
------------------------------------------------------------------------------------------------------------------------------------
P00 WARN: option repo1-retention-full is not set, the repository may run out of space
P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out of space
HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum.
P00 WARN: diff backup cannot alter 'checksum-page' option to 'false', reset to 'true' from [BACKUP-FULL-2]
P00 WARN: file 'changetime.txt' has timestamp earlier than prior backup, enabling delta checksum
@ -1119,7 +1119,7 @@ restore_command = '[BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf
incr backup - add files and remove tablespace 2 (backup host)
> [CONTAINER-EXEC] backup [BACKREST-BIN] --config=[TEST_PATH]/backup/pgbackrest.conf --no-online --process-max=1 --stanza=db backup
------------------------------------------------------------------------------------------------------------------------------------
P00 WARN: option repo1-retention-full is not set, the repository may run out of space
P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out of space
HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum.
P00 WARN: incr backup cannot alter 'checksum-page' option to 'false', reset to 'true' from [BACKUP-DIFF-1]
P00 WARN: page misalignment in file db-master:[TEST_PATH]/db-master/db/base-2/pg_tblspc/2/[TS_PATH-1]/32768/tablespace2b.txt: file size 8 is not divisible by page size 8192
@ -1328,7 +1328,7 @@ backrest-checksum="[CHECKSUM]"
incr backup - update files (backup host)
> [CONTAINER-EXEC] backup [BACKREST-BIN] --config=[TEST_PATH]/backup/pgbackrest.conf --no-online --stanza=db backup
------------------------------------------------------------------------------------------------------------------------------------
P00 WARN: option repo1-retention-full is not set, the repository may run out of space
P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out of space
HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum.
P00 WARN: incr backup cannot alter 'checksum-page' option to 'false', reset to 'true' from [BACKUP-INCR-3]
P00 WARN: file 'base/16384/17000' has same timestamp as prior but different size, enabling delta checksum
@ -1539,7 +1539,7 @@ backrest-checksum="[CHECKSUM]"
diff backup - updates since last full (backup host)
> [CONTAINER-EXEC] backup [BACKREST-BIN] --config=[TEST_PATH]/backup/pgbackrest.conf --no-online --process-max=1 --type=diff --stanza=db backup
------------------------------------------------------------------------------------------------------------------------------------
P00 WARN: option repo1-retention-full is not set, the repository may run out of space
P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out of space
HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum.
P00 WARN: diff backup cannot alter 'checksum-page' option to 'false', reset to 'true' from [BACKUP-FULL-2]
P00 WARN: file 'base/16384/17000' has same timestamp as prior but different size, enabling delta checksum
@ -1753,7 +1753,7 @@ backrest-checksum="[CHECKSUM]"
diff backup - remove files (backup host)
> [CONTAINER-EXEC] backup [BACKREST-BIN] --config=[TEST_PATH]/backup/pgbackrest.conf --no-online --process-max=1 --type=diff --stanza=db backup
------------------------------------------------------------------------------------------------------------------------------------
P00 WARN: option repo1-retention-full is not set, the repository may run out of space
P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out of space
HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum.
P00 WARN: diff backup cannot alter compress-type option to 'lz4', reset to value in [BACKUP-FULL-2]
P00 WARN: diff backup cannot alter 'checksum-page' option to 'false', reset to 'true' from [BACKUP-FULL-2]
@ -1966,7 +1966,7 @@ backrest-checksum="[CHECKSUM]"
full backup - update file (backup host)
> [CONTAINER-EXEC] backup [BACKREST-BIN] --config=[TEST_PATH]/backup/pgbackrest.conf --no-online --type=full --stanza=db backup
------------------------------------------------------------------------------------------------------------------------------------
P00 WARN: option repo1-retention-full is not set, the repository may run out of space
P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out of space
HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum.
+ supplemental file: [TEST_PATH]/db-master/pgbackrest.conf
@ -2179,7 +2179,7 @@ expire full=1 (backup host)
diff backup - add file (backup host)
> [CONTAINER-EXEC] backup [BACKREST-BIN] --config=[TEST_PATH]/backup/pgbackrest.conf --no-online --checksum-page --type=diff --stanza=db backup
------------------------------------------------------------------------------------------------------------------------------------
P00 WARN: option repo1-retention-full is not set, the repository may run out of space
P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out of space
HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum.
+ supplemental file: [TEST_PATH]/db-master/pgbackrest.conf
@ -2422,7 +2422,7 @@ diff backup - option backup-standby reset - backup performed from master (backup
> [CONTAINER-EXEC] backup [BACKREST-BIN] --config=[TEST_PATH]/backup/pgbackrest.conf --no-online --log-level-console=info --backup-standby --type=diff --stanza=db backup
------------------------------------------------------------------------------------------------------------------------------------
P00 INFO: backup command begin [BACKREST-VERSION]: --backup-standby --buffer-size=[BUFFER-SIZE] --compress-level=3 --compress-level-network=1 --compress-type=lz4 --config=[TEST_PATH]/backup/pgbackrest.conf --db-timeout=45 --lock-path=[TEST_PATH]/backup/lock --log-level-console=info --log-level-file=[LOG-LEVEL-FILE] --log-level-stderr=off --log-path=[TEST_PATH]/backup/log[] --no-log-timestamp --no-online --pg1-host=db-master --pg1-host-cmd=[BACKREST-BIN] --pg1-host-config=[TEST_PATH]/db-master/pgbackrest.conf --pg1-host-user=[USER-1] --pg1-path=[TEST_PATH]/db-master/db/base-2/base --process-max=2 --protocol-timeout=60 --repo1-cipher-pass=<redacted> --repo1-cipher-type=aes-256-cbc --repo1-path=/ --repo1-s3-bucket=pgbackrest-dev --repo1-s3-endpoint=s3.amazonaws.com --repo1-s3-key=<redacted> --repo1-s3-key-secret=<redacted> --repo1-s3-region=us-east-1 --no-repo1-s3-verify-tls --repo1-type=s3 --stanza=db --start-fast --type=diff
P00 WARN: option repo1-retention-full is not set, the repository may run out of space
P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out of space
HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum.
P00 WARN: option backup-standby is enabled but backup is offline - backups will be performed from the primary
P00 INFO: last backup label = [BACKUP-FULL-3], version = [VERSION-1]

View File

@ -2431,7 +2431,7 @@ Expire diff with repo-retention-archive with warning repo-retention-diff not set
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config="[TEST_PATH]/db-master/pgbackrest.conf" --stanza=db --log-level-console=detail --repo1-retention-archive-type=diff --repo1-retention-archive=1 expire
------------------------------------------------------------------------------------------------------------------------------------
P00 INFO: expire command begin [BACKREST-VERSION]: --buffer-size=[BUFFER-SIZE] --config=[TEST_PATH]/db-master/pgbackrest.conf --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=[LOG-LEVEL-FILE] --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log[] --no-log-timestamp --repo1-path=[TEST_PATH]/db-master/repo --repo1-retention-archive=1 --repo1-retention-archive-type=diff --stanza=db
P00 WARN: option repo1-retention-full is not set, the repository may run out of space
P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out of space
HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum.
P00 WARN: option 'repo1-retention-diff' is not set for 'repo1-retention-archive-type=diff'
HINT: to retain differential backups indefinitely (without warning), set option 'repo1-retention-diff' to the maximum.
@ -2589,7 +2589,7 @@ Expire full with repo-retention-archive with warning repo-retention-full not set
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config="[TEST_PATH]/db-master/pgbackrest.conf" --stanza=db --log-level-console=detail --repo1-retention-archive-type=full --repo1-retention-archive=1 expire
------------------------------------------------------------------------------------------------------------------------------------
P00 INFO: expire command begin [BACKREST-VERSION]: --buffer-size=[BUFFER-SIZE] --config=[TEST_PATH]/db-master/pgbackrest.conf --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=[LOG-LEVEL-FILE] --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log[] --no-log-timestamp --repo1-path=[TEST_PATH]/db-master/repo --repo1-retention-archive=1 --repo1-retention-archive-type=full --stanza=db
P00 WARN: option repo1-retention-full is not set, the repository may run out of space
P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out of space
HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum.
P00 DETAIL: archive retention on backup [BACKUP-FULL-4], archiveId = 9.2-1, start = 00000001000000020000002A, stop = 00000001000000020000002C
P00 DETAIL: archive retention on backup [BACKUP-FULL-5], archiveId = 9.2-1, start = 000000010000000200000036, stop = 000000010000000200000038
@ -2936,7 +2936,7 @@ Expire no archive with warning since neither repo-retention-archive nor repo-ret
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config="[TEST_PATH]/db-master/pgbackrest.conf" --stanza=db --log-level-console=detail --repo1-retention-archive-type=diff expire
------------------------------------------------------------------------------------------------------------------------------------
P00 INFO: expire command begin [BACKREST-VERSION]: --buffer-size=[BUFFER-SIZE] --config=[TEST_PATH]/db-master/pgbackrest.conf --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=[LOG-LEVEL-FILE] --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log[] --no-log-timestamp --repo1-path=[TEST_PATH]/db-master/repo --repo1-retention-archive-type=diff --stanza=db
P00 WARN: option repo1-retention-full is not set, the repository may run out of space
P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out of space
HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum.
P00 WARN: WAL segments will not be expired: option 'repo1-retention-archive-type=diff' but neither option 'repo1-retention-archive' nor option 'repo1-retention-diff' is set
P00 INFO: option 'repo1-retention-archive' is not set - archive logs will not be expired

View File

@ -66,7 +66,7 @@ Create backups in current db version
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config="[TEST_PATH]/db-master/pgbackrest.conf" --stanza=db --log-level-console=detail --repo1-retention-archive-type=diff expire
------------------------------------------------------------------------------------------------------------------------------------
P00 INFO: expire command begin [BACKREST-VERSION]: --buffer-size=[BUFFER-SIZE] --config=[TEST_PATH]/db-master/pgbackrest.conf --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=[LOG-LEVEL-FILE] --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log[] --no-log-timestamp --repo1-path=[TEST_PATH]/db-master/repo --repo1-retention-archive-type=diff --stanza=db
P00 WARN: option repo1-retention-full is not set, the repository may run out of space
P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out of space
HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum.
P00 WARN: WAL segments will not be expired: option 'repo1-retention-archive-type=diff' but neither option 'repo1-retention-archive' nor option 'repo1-retention-diff' is set
P00 INFO: option 'repo1-retention-archive' is not set - archive logs will not be expired

View File

@ -85,15 +85,16 @@ testRun(void)
StringList *argListAvoidWarn = strLstDup(argListBase);
strLstAddZ(argListAvoidWarn, "--repo1-retention-full=1"); // avoid warning
const Buffer *backupInfoBase = harnessInfoChecksumZ
(
uint64_t timeNow = (uint64_t)time(NULL); // time in seconds since Epoch
String *backupInfoContent = strNewFmt(
"[backup:current]\n"
"20181119-152138F={"
"\"backrest-format\":5,\"backrest-version\":\"2.08dev\","
"\"backup-archive-start\":\"000000010000000000000002\",\"backup-archive-stop\":\"000000010000000000000002\","
"\"backup-info-repo-size\":2369186,\"backup-info-repo-size-delta\":2369186,"
"\"backup-info-size\":20162900,\"backup-info-size-delta\":20162900,"
"\"backup-timestamp-start\":1542640898,\"backup-timestamp-stop\":1542640911,\"backup-type\":\"full\","
"\"backup-timestamp-start\":%" PRIu64 ",\"backup-timestamp-stop\":%" PRIu64 ",\"backup-type\":\"full\","
"\"db-id\":1,\"option-archive-check\":true,\"option-archive-copy\":false,\"option-backup-standby\":false,"
"\"option-checksum-page\":true,\"option-compress\":true,\"option-hardlink\":false,\"option-online\":true}\n"
"20181119-152800F={"
@ -101,40 +102,40 @@ testRun(void)
"\"backup-archive-start\":\"000000010000000000000004\",\"backup-archive-stop\":\"000000010000000000000004\","
"\"backup-info-repo-size\":2369186,\"backup-info-repo-size-delta\":2369186,"
"\"backup-info-size\":20162900,\"backup-info-size-delta\":20162900,"
"\"backup-timestamp-start\":1542640898,\"backup-timestamp-stop\":1542640911,\"backup-type\":\"full\","
"\"backup-timestamp-start\":%" PRIu64 ",\"backup-timestamp-stop\":%" PRIu64 ",\"backup-type\":\"full\","
"\"db-id\":1,\"option-archive-check\":true,\"option-archive-copy\":false,\"option-backup-standby\":false,"
"\"option-checksum-page\":true,\"option-compress\":true,\"option-hardlink\":false,\"option-online\":true}\n"
"20181119-152800F_20181119-152152D={"
"\"backrest-format\":5,\"backrest-version\":\"2.08dev\",\"backup-archive-start\":\"000000010000000000000005\","
"\"backup-archive-stop\":\"000000010000000000000005\",\"backup-info-repo-size\":2369186,"
"\"backup-info-repo-size-delta\":346,\"backup-info-size\":20162900,\"backup-info-size-delta\":8428,"
"\"backup-prior\":\"20181119-152800F\",\"backup-reference\":[\"20181119-152800F\"],"
"\"backup-timestamp-start\":1542640912,\"backup-timestamp-stop\":1542640915,\"backup-type\":\"diff\","
"\"db-id\":1,\"option-archive-check\":true,\"option-archive-copy\":false,\"option-backup-standby\":false,"
"\"option-checksum-page\":true,\"option-compress\":true,\"option-hardlink\":false,\"option-online\":true}\n"
"20181119-152800F_20181119-152155I={"
"\"backrest-format\":5,\"backrest-version\":\"2.08dev\",\"backup-archive-start\":\"000000010000000000000006\","
"\"backup-archive-stop\":\"000000010000000000000006\",\"backup-info-repo-size\":2369186,"
"\"backup-info-repo-size-delta\":346,\"backup-info-size\":20162900,\"backup-info-size-delta\":8428,"
"\"backup-prior\":\"20181119-152800F\",\"backup-reference\":[\"20181119-152800F\"],"
"\"backup-timestamp-start\":%" PRIu64 ",\"backup-timestamp-stop\":%" PRIu64 ",\"backup-type\":\"diff\","
"\"db-id\":1,\"option-archive-check\":true,\"option-archive-copy\":false,\"option-backup-standby\":false,"
"\"option-checksum-page\":true,\"option-compress\":true,\"option-hardlink\":false,\"option-online\":true}\n"
"20181119-152800F_20181119-152155I={"
"\"backrest-format\":5,\"backrest-version\":\"2.08dev\",\"backup-archive-start\":\"000000010000000000000007\","
"\"backup-archive-stop\":\"000000010000000000000007\",\"backup-info-repo-size\":2369186,"
"\"backup-info-repo-size-delta\":346,\"backup-info-size\":20162900,\"backup-info-size-delta\":8428,"
"\"backup-prior\":\"20181119-152800F_20181119-152152D\","
"\"backup-reference\":[\"20181119-152800F\",\"20181119-152800F_20181119-152152D\"],"
"\"backup-timestamp-start\":1542640912,\"backup-timestamp-stop\":1542640915,\"backup-type\":\"incr\","
"\"backup-timestamp-start\":%" PRIu64 ",\"backup-timestamp-stop\":%" PRIu64 ",\"backup-type\":\"incr\","
"\"db-id\":1,\"option-archive-check\":true,\"option-archive-copy\":false,\"option-backup-standby\":false,"
"\"option-checksum-page\":true,\"option-compress\":true,\"option-hardlink\":false,\"option-online\":true}\n"
"20181119-152900F={"
"\"backrest-format\":5,\"backrest-version\":\"2.08dev\","
"\"backup-archive-start\":\"000000010000000000000007\",\"backup-archive-stop\":\"000000010000000000000007\","
"\"backup-archive-start\":\"000000010000000000000009\",\"backup-archive-stop\":\"000000010000000000000009\","
"\"backup-info-repo-size\":2369186,\"backup-info-repo-size-delta\":2369186,"
"\"backup-info-size\":20162900,\"backup-info-size-delta\":20162900,"
"\"backup-timestamp-start\":1542640898,\"backup-timestamp-stop\":1542640911,\"backup-type\":\"full\","
"\"backup-timestamp-start\":%" PRIu64 ",\"backup-timestamp-stop\":%" PRIu64 ",\"backup-type\":\"full\","
"\"db-id\":1,\"option-archive-check\":true,\"option-archive-copy\":false,\"option-backup-standby\":false,"
"\"option-checksum-page\":true,\"option-compress\":true,\"option-hardlink\":false,\"option-online\":true}\n"
"20181119-152900F_20181119-152600D={"
"\"backrest-format\":5,\"backrest-version\":\"2.08dev\",\"backup-archive-start\":\"000000010000000000000008\","
"\"backup-archive-stop\":\"000000010000000000000008\",\"backup-info-repo-size\":2369186,"
"\"backrest-format\":5,\"backrest-version\":\"2.08dev\",\"backup-archive-start\":\"000000010000000000000011\","
"\"backup-archive-stop\":\"000000010000000000000011\",\"backup-info-repo-size\":2369186,"
"\"backup-info-repo-size-delta\":346,\"backup-info-size\":20162900,\"backup-info-size-delta\":8428,"
"\"backup-prior\":\"20181119-152900F\",\"backup-reference\":[\"20181119-152900F\"],"
"\"backup-timestamp-start\":1542640912,\"backup-timestamp-stop\":1542640915,\"backup-type\":\"diff\","
"\"backup-timestamp-start\":%" PRIu64 ",\"backup-timestamp-stop\":%" PRIu64 ",\"backup-type\":\"diff\","
"\"db-id\":1,\"option-archive-check\":true,\"option-archive-copy\":false,\"option-backup-standby\":false,"
"\"option-checksum-page\":true,\"option-compress\":true,\"option-hardlink\":false,\"option-online\":true}\n"
"\n"
@ -147,8 +148,12 @@ testRun(void)
"\n"
"[db:history]\n"
"1={\"db-catalog-version\":201409291,\"db-control-version\":942,\"db-system-id\":6625592122879095702,"
"\"db-version\":\"9.4\"}"
);
"\"db-version\":\"9.4\"}", timeNow - (41 * SEC_PER_DAY), timeNow - (40 * SEC_PER_DAY), timeNow - (30 * SEC_PER_DAY),
timeNow - (30 * SEC_PER_DAY), timeNow - (25 * SEC_PER_DAY), timeNow - (25 * SEC_PER_DAY), timeNow - (20 * SEC_PER_DAY),
timeNow - (20 * SEC_PER_DAY), timeNow - (10 * SEC_PER_DAY), timeNow - (10 * SEC_PER_DAY), timeNow - (5 * SEC_PER_DAY),
timeNow - (5 * SEC_PER_DAY));
const Buffer *backupInfoBase = harnessInfoChecksumZ(strPtr(backupInfoContent));
// *****************************************************************************************************************************
if (testBegin("expireBackup()"))
@ -214,9 +219,10 @@ testRun(void)
TEST_RESULT_UINT(expireFullBackup(infoBackup), 0, "retention-full not set");
harnessLogResult(
"P00 WARN: option repo1-retention-full is not set, the repository may run out of space\n"
" HINT: to retain full backups indefinitely (without warning), "
"set option 'repo1-retention-full' to the maximum.");
"P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out"
" of space\n"
" HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the"
" maximum.");
//--------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("retention-full set - full backup no dependencies expired");
@ -407,7 +413,7 @@ testRun(void)
"\n"
"[db:history]\n"
"1={\"db-catalog-version\":201409291,\"db-control-version\":942,\"db-system-id\":6625592122879095702,"
"\"db-version\":\"9.4\"}"));
"\"db-version\":\"9.4\"}"));
InfoBackup *infoBackup = NULL;
TEST_ASSIGN(infoBackup, infoBackupLoadFile(storageTest, backupInfoFileName, cipherTypeNone, NULL), "get backup.info");
@ -530,13 +536,17 @@ testRun(void)
InfoBackup *infoBackup = NULL;
TEST_ASSIGN(infoBackup, infoBackupNewLoad(ioBufferReadNew(backupInfoContent)), "get backup.info");
TEST_RESULT_VOID(removeExpiredArchive(infoBackup), "archive retention not set");
TEST_RESULT_VOID(removeExpiredArchive(infoBackup, false), "archive retention not set");
harnessLogResult(
"P00 WARN: option repo1-retention-full is not set, the repository may run out of space\n"
" HINT: to retain full backups indefinitely (without warning), "
"set option 'repo1-retention-full' to the maximum.\n"
"P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out"
" of space\n"
" HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the"
" maximum.\n"
"P00 INFO: option 'repo1-retention-archive' is not set - archive logs will not be expired");
TEST_RESULT_VOID(removeExpiredArchive(infoBackup, true), "archive retention not set - retention-full-type=time");
harnessLogResult("P00 INFO: time-based archive retention not met - archive logs will not be expired");
//--------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("retention-archive set - no current backups");
@ -544,11 +554,12 @@ testRun(void)
strLstAddZ(argList, "--repo1-retention-archive=4");
harnessCfgLoad(cfgCmdExpire, argList);
TEST_RESULT_VOID(removeExpiredArchive(infoBackup), "archive retention set, retention type default, no current backups");
TEST_RESULT_VOID(removeExpiredArchive(infoBackup, false), "archive retention set, retention type default, no current backups");
harnessLogResult(
"P00 WARN: option repo1-retention-full is not set, the repository may run out of space\n"
" HINT: to retain full backups indefinitely (without warning), "
"set option 'repo1-retention-full' to the maximum.");
"P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out"
" of space\n"
" HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the"
" maximum.");
//--------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("retention-archive set - no archive on disk");
@ -642,7 +653,7 @@ testRun(void)
"1={\"db-id\":6625592122879095702,\"db-version\":\"9.4\"}\n"
"2={\"db-id\":6626363367545678089,\"db-version\":\"10\"}"));
TEST_RESULT_VOID(removeExpiredArchive(infoBackup), "no archive on disk");
TEST_RESULT_VOID(removeExpiredArchive(infoBackup, true), "no archive on disk");
//--------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("retention-archive set - remove archives across timelines");
@ -655,7 +666,7 @@ testRun(void)
strLstAddZ(argList, "--repo1-retention-archive=3");
harnessCfgLoad(cfgCmdExpire, argList);
TEST_RESULT_VOID(removeExpiredArchive(infoBackup), "archive retention type = full (default), repo1-retention-archive=3");
TEST_RESULT_VOID(removeExpiredArchive(infoBackup, false), "archive retention type = full (default), repo1-retention-archive=3");
TEST_RESULT_STR(
strLstJoin(strLstSort(storageListP(
@ -679,7 +690,7 @@ testRun(void)
strLstAddZ(argList, "--repo1-retention-archive=2");
harnessCfgLoad(cfgCmdExpire, argList);
TEST_RESULT_VOID(removeExpiredArchive(infoBackup), "archive retention type = full (default), repo1-retention-archive=2");
TEST_RESULT_VOID(removeExpiredArchive(infoBackup, false), "archive retention type = full (default), repo1-retention-archive=2");
TEST_RESULT_STR(
strLstJoin(strLstSort(storageListP(
@ -704,7 +715,7 @@ testRun(void)
strLstAddZ(argList, "--repo1-retention-archive=1");
harnessCfgLoad(cfgCmdExpire, argList);
TEST_RESULT_VOID(removeExpiredArchive(infoBackup), "archive retention type = full (default), repo1-retention-archive=1");
TEST_RESULT_VOID(removeExpiredArchive(infoBackup, false), "archive retention type = full (default), repo1-retention-archive=1");
TEST_RESULT_STR(
strLstJoin(strLstSort(storageListP(
@ -731,7 +742,7 @@ testRun(void)
harnessCfgLoad(cfgCmdExpire, argList);
TEST_RESULT_VOID(
removeExpiredArchive(infoBackup),
removeExpiredArchive(infoBackup, false),
"full counts as differential and incremental associated with differential expires");
String *result = strNew("");
@ -768,7 +779,7 @@ testRun(void)
// Regenerate archive
archiveGenerate(storageTest, archiveStanzaPath, 1, 10, "9.4-1", "0000000200000000");
TEST_RESULT_VOID(removeExpiredArchive(infoBackup), "differential and full count as an incremental");
TEST_RESULT_VOID(removeExpiredArchive(infoBackup, false), "differential and full count as an incremental");
result = strNew("");
strCatFmt(
@ -1020,7 +1031,7 @@ testRun(void)
harnessCfgLoad(cfgCmdExpire, argList);
TEST_RESULT_VOID(
removeExpiredArchive(infoBackup), "backup selected for retention does not have archive-start so do nothing");
removeExpiredArchive(infoBackup, false), "backup selected for retention does not have archive-start so do nothing");
TEST_RESULT_STR(
strLstJoin(strLstSort(storageListP(
storageTest, strNewFmt("%s/%s/%s", strPtr(archiveStanzaPath), "9.4-1", "0000000100000000")), sortOrderAsc), ", "),
@ -1036,7 +1047,7 @@ testRun(void)
harnessLogLevelSet(logLevelDetail);
TEST_RESULT_VOID(
removeExpiredArchive(infoBackup), "backup earlier than selected for retention does not have archive-start");
removeExpiredArchive(infoBackup, false), "backup earlier than selected for retention does not have archive-start");
harnessLogResult(
"P00 DETAIL: archive retention on backup 20181119-152138F, archiveId = 9.4-1, start = 000000010000000000000002,"
" stop = 000000010000000000000002\n"
@ -1804,6 +1815,233 @@ testRun(void)
harnessLogLevelReset();
}
// *****************************************************************************************************************************
if (testBegin("expireTimeBasedBackup()"))
{
//--------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("no current backups");
InfoBackup *infoBackup = NULL;
TEST_ASSIGN(infoBackup, infoBackupNewLoad(ioBufferReadNew(harnessInfoChecksumZ(
"[db]\n"
"db-catalog-version=201409291\n"
"db-control-version=942\n"
"db-id=1\n"
"db-system-id=6625592122879095702\n"
"db-version=\"9.4\"\n"
"\n"
"[db:history]\n"
"1={\"db-catalog-version\":201409291,\"db-control-version\":942,\"db-system-id\":6625592122879095702,"
"\"db-version\":\"9.4\"}"))), "empty backup.info");
TEST_RESULT_UINT(expireTimeBasedBackup(infoBackup, (time_t)(timeNow - (40 * SEC_PER_DAY))), 0, "no backups to expire");
//--------------------------------------------------------------------------------------------------------------------------
// Set up
StringList *argListTime = strLstDup(argListBase);
strLstAddZ(argListTime, "--repo1-retention-full-type=time");
// Create backup.info and archive.info
storagePutP(storageNewWriteP(storageTest, backupInfoFileName), backupInfoBase);
storagePutP(
storageNewWriteP(storageTest, archiveInfoFileName),
harnessInfoChecksumZ(
"[db]\n"
"db-id=1\n"
"db-system-id=6625592122879095702\n"
"db-version=\"9.4\"\n"
"\n"
"[db:history]\n"
"1={\"db-id\":6625592122879095702,\"db-version\":\"9.4\"}"));
// Write backup.manifest so infoBackup reconstruct produces same results as backup.info on disk
storagePutP(
storageNewWriteP(storageTest, strNewFmt("%s/20181119-152138F/" BACKUP_MANIFEST_FILE, strPtr(backupStanzaPath))),
BUFSTRDEF("tmp"));
storagePutP(
storageNewWriteP(storageTest, strNewFmt("%s/20181119-152800F/" BACKUP_MANIFEST_FILE, strPtr(backupStanzaPath))),
BUFSTRDEF("tmp"));
storagePutP(
storageNewWriteP(storageTest, strNewFmt("%s/20181119-152800F_20181119-152152D/" BACKUP_MANIFEST_FILE,
strPtr(backupStanzaPath))), BUFSTRDEF("tmp"));
storagePutP(
storageNewWriteP(storageTest, strNewFmt("%s/20181119-152800F_20181119-152155I/" BACKUP_MANIFEST_FILE,
strPtr(backupStanzaPath))), BUFSTRDEF("tmp"));
storagePutP(
storageNewWriteP(storageTest, strNewFmt("%s/20181119-152900F/" BACKUP_MANIFEST_FILE, strPtr(backupStanzaPath))),
BUFSTRDEF("tmp"));
storagePutP(
storageNewWriteP(storageTest, strNewFmt("%s/20181119-152900F_20181119-152600D/" BACKUP_MANIFEST_FILE,
strPtr(backupStanzaPath))), BUFSTRDEF("tmp"));
// Genreate archive for backups in backup.info
archiveGenerate(storageTest, archiveStanzaPath, 1, 11, "9.4-1", "0000000100000000");
// Set the log level to detail so archive expiration messages are seen
harnessLogLevelSet(logLevelDetail);
//--------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("oldest backup not expired");
StringList *argList = strLstDup(argListTime);
harnessCfgLoad(cfgCmdExpire, argList);
TEST_ASSIGN(infoBackup, infoBackupNewLoad(ioBufferReadNew(backupInfoBase)), "get backup.info");
TEST_RESULT_VOID(cmdExpire(), "repo-retention-full not set for time-based");
harnessLogResult(
"P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=time', the repository may run out"
" of space\n"
" HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the"
" maximum.\n"
"P00 INFO: time-based archive retention not met - archive logs will not be expired");
// Stop time equals retention time
TEST_RESULT_UINT(
expireTimeBasedBackup(infoBackup, (time_t)(timeNow - (40 * SEC_PER_DAY))), 0,
"oldest backup stop time equals retention time");
TEST_RESULT_STR_Z(
strLstJoin(infoBackupDataLabelList(infoBackup, NULL), ", "),
"20181119-152138F, 20181119-152800F, 20181119-152800F_20181119-152152D, 20181119-152800F_20181119-152155I, "
"20181119-152900F, 20181119-152900F_20181119-152600D", "no backups expired");
// Add a time period
strLstAddZ(argList, "--repo1-retention-full=35");
harnessCfgLoad(cfgCmdExpire, argList);
TEST_RESULT_VOID(cmdExpire(), "oldest backup older but other backups too young");
TEST_RESULT_STR(
strLstJoin(strLstSort(storageListP(
storageTest, strNewFmt("%s/%s/%s", strPtr(archiveStanzaPath), "9.4-1", "0000000100000000")), sortOrderAsc), ", "),
archiveExpectList(1, 11, "0000000100000000"),
"no archives expired");
TEST_RESULT_STR_Z(
strLstJoin(infoBackupDataLabelList(infoBackup, NULL), ", "),
"20181119-152138F, 20181119-152800F, 20181119-152800F_20181119-152152D, 20181119-152800F_20181119-152155I, "
"20181119-152900F, 20181119-152900F_20181119-152600D", "no backups expired");
harnessLogResult("P00 INFO: time-based archive retention not met - archive logs will not be expired");
//--------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("oldest backup expired");
argList = strLstDup(argListTime);
strLstAddZ(argList, "--repo1-retention-full=30");
strLstAddZ(argList, "--dry-run");
harnessCfgLoad(cfgCmdExpire, argList);
TEST_RESULT_VOID(cmdExpire(), "only oldest backup expired - dry-run");
harnessLogResult(
"P00 INFO: [DRY-RUN] expire time-based backup 20181119-152138F\n"
"P00 INFO: [DRY-RUN] remove expired backup 20181119-152138F\n"
"P00 DETAIL: [DRY-RUN] archive retention on backup 20181119-152800F, archiveId = 9.4-1,"
" start = 000000010000000000000004\n"
"P00 DETAIL: [DRY-RUN] remove archive: archiveId = 9.4-1, start = 000000010000000000000001,"
" stop = 000000010000000000000003");
strLstAddZ(argList, "--repo1-retention-archive=9999999");
harnessCfgLoad(cfgCmdExpire, argList);
TEST_RESULT_VOID(cmdExpire(), "only oldest backup expired - dry-run, retention-archive set to max, no archives expired");
harnessLogResult(
"P00 INFO: [DRY-RUN] expire time-based backup 20181119-152138F\n"
"P00 INFO: [DRY-RUN] remove expired backup 20181119-152138F");
argList = strLstDup(argListTime);
strLstAddZ(argList, "--repo1-retention-full=30");
strLstAddZ(argList, "--repo1-retention-archive=1"); // 1-day: expire all non-essential archive prior to newest full backup
strLstAddZ(argList, "--dry-run");
harnessCfgLoad(cfgCmdExpire, argList);
TEST_RESULT_VOID(cmdExpire(), "only oldest backup expired but retention archive set lower - dry-run");
harnessLogResult(
"P00 INFO: [DRY-RUN] expire time-based backup 20181119-152138F\n"
"P00 INFO: [DRY-RUN] remove expired backup 20181119-152138F\n"
"P00 DETAIL: [DRY-RUN] archive retention on backup 20181119-152800F, archiveId = 9.4-1,"
" start = 000000010000000000000004, stop = 000000010000000000000004\n"
"P00 DETAIL: [DRY-RUN] archive retention on backup 20181119-152800F_20181119-152152D, archiveId = 9.4-1,"
" start = 000000010000000000000006, stop = 000000010000000000000006\n"
"P00 DETAIL: [DRY-RUN] archive retention on backup 20181119-152800F_20181119-152155I, archiveId = 9.4-1,"
" start = 000000010000000000000007, stop = 000000010000000000000007\n"
"P00 DETAIL: [DRY-RUN] archive retention on backup 20181119-152900F, archiveId = 9.4-1,"
" start = 000000010000000000000009\n"
"P00 DETAIL: [DRY-RUN] remove archive: archiveId = 9.4-1, start = 000000010000000000000001,"
" stop = 000000010000000000000003\n"
"P00 DETAIL: [DRY-RUN] remove archive: archiveId = 9.4-1, start = 000000010000000000000005,"
" stop = 000000010000000000000005\n"
"P00 DETAIL: [DRY-RUN] remove archive: archiveId = 9.4-1, start = 000000010000000000000008,"
" stop = 000000010000000000000008");
//--------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("repo1-retention-archive-type=diff");
argList = strLstDup(argListTime);
strLstAddZ(argList, "--repo1-retention-full=30");
strLstAddZ(argList, "--repo1-retention-archive-type=diff");
strLstAddZ(argList, "--repo1-retention-archive=1"); // 1-diff: expire all non-essential archive prior to newest diff backup
strLstAddZ(argList, "--dry-run");
harnessCfgLoad(cfgCmdExpire, argList);
TEST_RESULT_VOID(cmdExpire(), "only oldest backup expired, retention archive is DIFF - dry-run");
harnessLogResult(
"P00 WARN: [DRY-RUN] option 'repo1-retention-diff' is not set for 'repo1-retention-archive-type=diff'\n"
" HINT: to retain differential backups indefinitely (without warning), set option 'repo1-retention-diff'"
" to the maximum.\n"
"P00 INFO: [DRY-RUN] expire time-based backup 20181119-152138F\n"
"P00 INFO: [DRY-RUN] remove expired backup 20181119-152138F\n"
"P00 DETAIL: [DRY-RUN] archive retention on backup 20181119-152800F, archiveId = 9.4-1,"
" start = 000000010000000000000004, stop = 000000010000000000000004\n"
"P00 DETAIL: [DRY-RUN] archive retention on backup 20181119-152800F_20181119-152152D, archiveId = 9.4-1,"
" start = 000000010000000000000006, stop = 000000010000000000000006\n"
"P00 DETAIL: [DRY-RUN] archive retention on backup 20181119-152800F_20181119-152155I, archiveId = 9.4-1,"
" start = 000000010000000000000007, stop = 000000010000000000000007\n"
"P00 DETAIL: [DRY-RUN] archive retention on backup 20181119-152900F, archiveId = 9.4-1,"
" start = 000000010000000000000009, stop = 000000010000000000000009\n"
"P00 DETAIL: [DRY-RUN] archive retention on backup 20181119-152900F_20181119-152600D, archiveId = 9.4-1,"
" start = 000000010000000000000011\n"
"P00 DETAIL: [DRY-RUN] remove archive: archiveId = 9.4-1, start = 000000010000000000000001,"
" stop = 000000010000000000000003\n"
"P00 DETAIL: [DRY-RUN] remove archive: archiveId = 9.4-1, start = 000000010000000000000005,"
" stop = 000000010000000000000005\n"
"P00 DETAIL: [DRY-RUN] remove archive: archiveId = 9.4-1, start = 000000010000000000000008,"
" stop = 000000010000000000000008\n"
"P00 DETAIL: [DRY-RUN] remove archive: archiveId = 9.4-1, start = 000000010000000000000010,"
" stop = 000000010000000000000010");
//--------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("expire oldest full");
argList = strLstDup(argListTime);
strLstAddZ(argList, "--repo1-retention-full=25");
harnessCfgLoad(cfgCmdExpire, argList);
// Expire oldest from backup.info only, leaving the backup and archives on disk then save backup.info without oldest backup
TEST_RESULT_UINT(expireTimeBasedBackup(infoBackup, (time_t)(timeNow - (25 * SEC_PER_DAY))), 1, "expire oldest backup");
TEST_RESULT_VOID(
infoBackupSaveFile(infoBackup, storageTest, backupInfoFileName, cipherTypeNone, NULL),
"save backup.info without oldest");
harnessLogResult("P00 INFO: expire time-based backup 20181119-152138F");
TEST_RESULT_VOID(cmdExpire(), "only oldest backup expired");
harnessLogResult(
"P00 INFO: remove expired backup 20181119-152138F\n"
"P00 DETAIL: archive retention on backup 20181119-152800F, archiveId = 9.4-1, start = 000000010000000000000004\n"
"P00 DETAIL: remove archive: archiveId = 9.4-1, start = 000000010000000000000001, stop = 000000010000000000000003");
//--------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("newest backup - retention met but must keep one");
argList = strLstDup(argListTime);
strLstAddZ(argList, "--repo1-retention-full=1");
harnessCfgLoad(cfgCmdExpire, argList);
TEST_RESULT_VOID(cmdExpire(), "expire all but newest");
harnessLogResult(
"P00 INFO: expire time-based backup set: 20181119-152800F, 20181119-152800F_20181119-152152D,"
" 20181119-152800F_20181119-152155I\n"
"P00 INFO: remove expired backup 20181119-152800F_20181119-152155I\n"
"P00 INFO: remove expired backup 20181119-152800F_20181119-152152D\n"
"P00 INFO: remove expired backup 20181119-152800F\n"
"P00 DETAIL: archive retention on backup 20181119-152900F, archiveId = 9.4-1, start = 000000010000000000000009\n"
"P00 DETAIL: remove archive: archiveId = 9.4-1, start = 000000010000000000000004, stop = 000000010000000000000008");
harnessLogLevelReset();
}
// *****************************************************************************************************************************
if (testBegin("archiveIdComparator()"))
{

View File

@ -370,10 +370,13 @@ testRun(void)
"NOTE: WAL segments required to make a backup consistent are always retained\n"
"until the backup is expired regardless of how this option is configured.\n"
"\n"
"If this value is not set, then the archive to expire will default to the\n"
"repo-retention-full (or repo-retention-diff) value corresponding to the\n"
"repo-retention-archive-type if set to full (or diff). This will ensure that WAL\n"
"is only expired for backups that are already expired.\n"
"If this value is not set and repo-retention-full-type is count (default), then\n"
"the archive to expire will default to the repo-retention-full (or\n"
"repo-retention-diff) value corresponding to the repo-retention-archive-type if\n"
"set to full (or diff). This will ensure that WAL is only expired for backups\n"
"that are already expired. If repo-retention-full-type is time, then this value\n"
"will default to removing archives that are earlier than the oldest full backup\n"
"retained after satisfying the repo-retention-full setting.\n"
"\n"
"This option must be set if repo-retention-archive-type is set to incr. If disk\n"
"space is at a premium, then this setting, in conjunction with\n"

View File

@ -142,7 +142,8 @@ testRun(void)
harnessLogLevelSet(logLevelWarn);
TEST_RESULT_VOID(harnessCfgLoad(cfgCmdExpire, argList), "load config for retention warning");
harnessLogResult(
"P00 WARN: option repo1-retention-full is not set, the repository may run out of space\n"
"P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out"
" of space\n"
" HINT: to retain full backups indefinitely (without warning), set option"
" 'repo1-retention-full' to the maximum.");
TEST_RESULT_BOOL(cfgOptionTest(cfgOptRepoRetentionArchive), false, " repo1-retention-archive not set");
@ -163,7 +164,8 @@ testRun(void)
TEST_RESULT_VOID(harnessCfgLoad(cfgCmdExpire, argList), "load config for retention warning");
harnessLogResult(
"P00 WARN: option repo1-retention-full is not set, the repository may run out of space\n"
"P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out"
" of space\n"
" HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full'"
" to the maximum.\n"
"P00 WARN: WAL segments will not be expired: option 'repo1-retention-archive-type=incr' but option"
@ -177,7 +179,8 @@ testRun(void)
TEST_RESULT_VOID(harnessCfgLoad(cfgCmdExpire, argList), "load config for retention warning");
harnessLogResult(
"P00 WARN: option repo1-retention-full is not set, the repository may run out of space\n"
"P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out"
" of space\n"
" HINT: to retain full backups indefinitely (without warning), set option"
" 'repo1-retention-full' to the maximum.\n"
"P00 WARN: WAL segments will not be expired: option 'repo1-retention-archive-type=diff' but neither option"
@ -188,7 +191,8 @@ testRun(void)
TEST_RESULT_VOID(harnessCfgLoad(cfgCmdExpire, argList), "load config for retention warning");
harnessLogResult(
"P00 WARN: option repo1-retention-full is not set, the repository may run out of space\n"
"P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out"
" of space\n"
" HINT: to retain full backups indefinitely (without warning), set option"
" 'repo1-retention-full' to the maximum.");
TEST_RESULT_INT(cfgOptionInt(cfgOptRepoRetentionArchive), 2, " repo1-retention-archive set to retention-diff");
@ -216,6 +220,16 @@ testRun(void)
TEST_RESULT_VOID(harnessCfgLoad(cfgCmdExpire, argList), "load config with success");
argList = strLstNew();
strLstAdd(argList, strNew("--stanza=db"));
strLstAdd(argList, strNew("--no-log-timestamp"));
strLstAdd(argList, strNew("--repo1-retention-full=1"));
strLstAdd(argList, strNew("--repo1-retention-full-type=time"));
harnessLogLevelSet(logLevelWarn);
TEST_RESULT_VOID(harnessCfgLoad(cfgCmdExpire, argList), "load config: retention-full-type=time, retention-full is set");
TEST_RESULT_BOOL(cfgOptionTest(cfgOptRepoRetentionArchive), false, " repo1-retention-archive not set");
// -------------------------------------------------------------------------------------------------------------------------
setenv("PGBACKREST_REPO1_S3_KEY", "mykey", true);
setenv("PGBACKREST_REPO1_S3_KEY_SECRET", "mysecretkey", true);