mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2024-12-12 10:04:14 +02:00
Expire WAL archive only when repo-retention-archive threshold is met.
Previously when retention-archive was set (either by the user or by default), archives prior to the archive-start of the oldest remaining full backup (after backup expiration occurred) would be expired even though the retention-archive threshold had not been met. For example, if there were 1 full backup remaining after backup expiration and the retention-archive was set to 2 and retention-archive-type=full, then archives prior to the archive-start of the remaining full backup would still be removed even though retention-archive required 2 full backups remaining before archives should be expired. The thought was to keep the archive directory clean and since the full backup did not require prior archives, it was safe to delete them. However, this has caused problems for some users in the past (because they needed the WAL for other purposes) and with the new adhoc and time-based retention features, it was decided that the archives should remain until the threshold was met. The archives will eventually be removed and if having them causes space issues, the expire command and the retention-archive can always be run and adjusted.
This commit is contained in:
parent
775e81a74d
commit
c5241e5007
@ -45,6 +45,16 @@
|
||||
</release-feature-list>
|
||||
|
||||
<release-improvement-list>
|
||||
<release-item>
|
||||
<release-item-contributor-list>
|
||||
<release-item-contributor id="cynthia.shang"/>
|
||||
</release-item-contributor-list>
|
||||
|
||||
<p>Expire WAL archive only when <br-option>repo-retention-archive</br-option> threshold is met.</p>
|
||||
|
||||
<p>WAL prior to the first full backup was previously expired after the first full backup. Now it is preserved according to retention settings.</p>
|
||||
</release-item>
|
||||
|
||||
<release-item>
|
||||
<release-item-contributor-list>
|
||||
<release-item-contributor id="cynthia.shang"/>
|
||||
|
@ -350,8 +350,9 @@ removeExpiredArchive(InfoBackup *infoBackup)
|
||||
sortOrderDesc);
|
||||
}
|
||||
|
||||
// Expire archives. If no backups were found then preserve current archive logs - too soon to expire them.
|
||||
if (strLstSize(globalBackupRetentionList) > 0)
|
||||
// Expire archives. If no backups were found or the number of backups found is not enough to satify archive retention
|
||||
// then preserve current archive logs - too soon to expire them.
|
||||
if (strLstSize(globalBackupRetentionList) > 0 && archiveRetention <= strLstSize(globalBackupRetentionList))
|
||||
{
|
||||
// Attempt to load the archive info file
|
||||
InfoArchive *infoArchive = infoArchiveLoadFile(
|
||||
@ -461,37 +462,21 @@ removeExpiredArchive(InfoBackup *infoBackup)
|
||||
// If we get here, then a local backup was found for retention
|
||||
StringList *localBackupArchiveRetentionList = strLstNew();
|
||||
|
||||
// If the archive retention is less than or equal to the number of all backups, then perform selective
|
||||
// expiration
|
||||
if (archiveRetention <= strLstSize(globalBackupRetentionList))
|
||||
// From the full list of backups in archive retention, find the intersection of local backups to retain
|
||||
// from oldest to newest
|
||||
for (unsigned int globalIdx = strLstSize(globalBackupArchiveRetentionList) - 1;
|
||||
(int)globalIdx >= 0; globalIdx--)
|
||||
{
|
||||
// From the full list of backups in archive retention, find the intersection of local backups to retain
|
||||
// from oldest to newest
|
||||
for (unsigned int globalIdx = strLstSize(globalBackupArchiveRetentionList) - 1;
|
||||
(int)globalIdx >= 0; globalIdx--)
|
||||
for (unsigned int localIdx = 0; localIdx < strLstSize(localBackupRetentionList); localIdx++)
|
||||
{
|
||||
for (unsigned int localIdx = 0; localIdx < strLstSize(localBackupRetentionList); localIdx++)
|
||||
if (strCmp(
|
||||
strLstGet(globalBackupArchiveRetentionList, globalIdx),
|
||||
strLstGet(localBackupRetentionList, localIdx)) == 0)
|
||||
{
|
||||
if (strCmp(
|
||||
strLstGet(globalBackupArchiveRetentionList, globalIdx),
|
||||
strLstGet(localBackupRetentionList, localIdx)) == 0)
|
||||
{
|
||||
strLstAdd(localBackupArchiveRetentionList, strLstGet(localBackupRetentionList, localIdx));
|
||||
}
|
||||
strLstAdd(localBackupArchiveRetentionList, strLstGet(localBackupRetentionList, localIdx));
|
||||
}
|
||||
}
|
||||
}
|
||||
// Else if there are not enough backups yet globally to start archive expiration then set the archive
|
||||
// retention to the oldest backup so anything prior to that will be removed as it is not needed but
|
||||
// everything else is. This is incase there are old archives left around so that they don't stay around
|
||||
// forever.
|
||||
else
|
||||
{
|
||||
LOG_INFO_FMT(
|
||||
"full backup total < %u - using oldest full backup for %s archive retention", archiveRetention,
|
||||
strPtr(archiveId));
|
||||
strLstAdd(localBackupArchiveRetentionList, strLstGet(localBackupRetentionList, 0));
|
||||
}
|
||||
|
||||
// If no local backups were found as part of retention then set the backup archive retention to the newest
|
||||
// backup so that the database is fully recoverable (can be recovered from the last backup through pitr)
|
||||
|
@ -3031,174 +3031,3 @@ backrest-checksum="[CHECKSUM]"
|
||||
00000001000000020000006F-0000000000000000000000000000000000000000.gz
|
||||
000000010000000200000070-0000000000000000000000000000000000000000
|
||||
000000010000000200000071-0000000000000000000000000000000000000000.gz
|
||||
|
||||
+ supplemental file: [TEST_PATH]/db-master/repo/backup/db/backup.info
|
||||
---------------------------------------------------------------------
|
||||
[backrest]
|
||||
backrest-format=5
|
||||
backrest-version="[VERSION-1]"
|
||||
|
||||
[backup:current]
|
||||
[BACKUP-FULL-8]={"backrest-format":5,"backrest-version":"[VERSION-1]","backup-archive-start":"000000010000000200000054","backup-archive-stop":"000000010000000200000056","backup-info-repo-size":[SIZE],"backup-info-repo-size-delta":[DELTA],"backup-info-size":[SIZE],"backup-info-size-delta":[DELTA],"backup-timestamp-start":[TIMESTAMP],"backup-timestamp-stop":[TIMESTAMP],"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}
|
||||
[BACKUP-INCR-4]={"backrest-format":5,"backrest-version":"[VERSION-1]","backup-archive-start":"00000001000000020000005A","backup-archive-stop":"00000001000000020000005C","backup-info-repo-size":[SIZE],"backup-info-repo-size-delta":[DELTA],"backup-info-size":[SIZE],"backup-info-size-delta":[DELTA],"backup-prior":"[BACKUP-FULL-8]","backup-reference":[],"backup-timestamp-start":[TIMESTAMP],"backup-timestamp-stop":[TIMESTAMP],"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}
|
||||
[BACKUP-FULL-9]={"backrest-format":5,"backrest-version":"[VERSION-1]","backup-archive-start":"000000010000000200000060","backup-archive-stop":"000000010000000200000062","backup-info-repo-size":[SIZE],"backup-info-repo-size-delta":[DELTA],"backup-info-size":[SIZE],"backup-info-size-delta":[DELTA],"backup-timestamp-start":[TIMESTAMP],"backup-timestamp-stop":[TIMESTAMP],"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}
|
||||
[BACKUP-DIFF-8]={"backrest-format":5,"backrest-version":"[VERSION-1]","backup-archive-start":"000000010000000200000066","backup-archive-stop":"000000010000000200000068","backup-info-repo-size":[SIZE],"backup-info-repo-size-delta":[DELTA],"backup-info-size":[SIZE],"backup-info-size-delta":[DELTA],"backup-prior":"[BACKUP-FULL-9]","backup-reference":[],"backup-timestamp-start":[TIMESTAMP],"backup-timestamp-stop":[TIMESTAMP],"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}
|
||||
[BACKUP-DIFF-9]={"backrest-format":5,"backrest-version":"[VERSION-1]","backup-archive-start":"00000001000000020000006C","backup-archive-stop":"00000001000000020000006E","backup-info-repo-size":[SIZE],"backup-info-repo-size-delta":[DELTA],"backup-info-size":[SIZE],"backup-info-size-delta":[DELTA],"backup-prior":"[BACKUP-FULL-9]","backup-reference":[],"backup-timestamp-start":[TIMESTAMP],"backup-timestamp-stop":[TIMESTAMP],"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}
|
||||
|
||||
[db]
|
||||
db-catalog-version=201204301
|
||||
db-control-version=922
|
||||
db-id=1
|
||||
db-system-id=1000000000000000092
|
||||
db-version="9.2"
|
||||
|
||||
[db:history]
|
||||
1={"db-catalog-version":201204301,"db-control-version":922,"db-system-id":1000000000000000092,"db-version":"9.2"}
|
||||
|
||||
[backrest]
|
||||
backrest-checksum="[CHECKSUM]"
|
||||
|
||||
> ls [TEST_PATH]/db-master/repo/backup/db | grep -v "backup.*"
|
||||
------------------------------------------------------------------------------------------------------------------------------------
|
||||
[BACKUP-FULL-8]
|
||||
[BACKUP-INCR-4]
|
||||
[BACKUP-FULL-9]
|
||||
[BACKUP-DIFF-8]
|
||||
[BACKUP-DIFF-9]
|
||||
|
||||
> ls -R [TEST_PATH]/db-master/repo/archive/db | grep -v "archive.info"
|
||||
------------------------------------------------------------------------------------------------------------------------------------
|
||||
[TEST_PATH]/db-master/repo/archive/db:
|
||||
|
||||
[TEST_PATH]/db-master/repo/archive/db/9.2-1:
|
||||
|
||||
[TEST_PATH]/db-master/repo/archive/db/9.2-1/0000000100000002:
|
||||
00000001000000020000002A-0000000000000000000000000000000000000000.gz
|
||||
00000001000000020000002B-0000000000000000000000000000000000000000
|
||||
00000001000000020000002C-0000000000000000000000000000000000000000.gz
|
||||
000000010000000200000036-0000000000000000000000000000000000000000.gz
|
||||
000000010000000200000037-0000000000000000000000000000000000000000
|
||||
000000010000000200000038-0000000000000000000000000000000000000000.gz
|
||||
00000001000000020000003C-0000000000000000000000000000000000000000.gz
|
||||
00000001000000020000003D-0000000000000000000000000000000000000000
|
||||
00000001000000020000003E-0000000000000000000000000000000000000000.gz
|
||||
000000010000000200000042-0000000000000000000000000000000000000000.gz
|
||||
000000010000000200000043-0000000000000000000000000000000000000000
|
||||
000000010000000200000044-0000000000000000000000000000000000000000.gz
|
||||
000000010000000200000048-0000000000000000000000000000000000000000.gz
|
||||
000000010000000200000049-0000000000000000000000000000000000000000
|
||||
00000001000000020000004A-0000000000000000000000000000000000000000.gz
|
||||
00000001000000020000004E-0000000000000000000000000000000000000000.gz
|
||||
00000001000000020000004F-0000000000000000000000000000000000000000
|
||||
000000010000000200000050-0000000000000000000000000000000000000000.gz
|
||||
000000010000000200000054-0000000000000000000000000000000000000000.gz
|
||||
000000010000000200000055-0000000000000000000000000000000000000000
|
||||
000000010000000200000056-0000000000000000000000000000000000000000.gz
|
||||
000000010000000200000057-0000000000000000000000000000000000000000.gz
|
||||
000000010000000200000058-0000000000000000000000000000000000000000
|
||||
000000010000000200000059-0000000000000000000000000000000000000000.gz
|
||||
00000001000000020000005A-0000000000000000000000000000000000000000.gz
|
||||
00000001000000020000005B-0000000000000000000000000000000000000000
|
||||
00000001000000020000005C-0000000000000000000000000000000000000000.gz
|
||||
00000001000000020000005D-0000000000000000000000000000000000000000.gz
|
||||
00000001000000020000005E-0000000000000000000000000000000000000000
|
||||
00000001000000020000005F-0000000000000000000000000000000000000000.gz
|
||||
000000010000000200000060-0000000000000000000000000000000000000000.gz
|
||||
000000010000000200000061-0000000000000000000000000000000000000000
|
||||
000000010000000200000062-0000000000000000000000000000000000000000.gz
|
||||
000000010000000200000063-0000000000000000000000000000000000000000.gz
|
||||
000000010000000200000064-0000000000000000000000000000000000000000
|
||||
000000010000000200000065-0000000000000000000000000000000000000000.gz
|
||||
000000010000000200000066-0000000000000000000000000000000000000000.gz
|
||||
000000010000000200000067-0000000000000000000000000000000000000000
|
||||
000000010000000200000068-0000000000000000000000000000000000000000.gz
|
||||
000000010000000200000069-0000000000000000000000000000000000000000.gz
|
||||
00000001000000020000006A-0000000000000000000000000000000000000000
|
||||
00000001000000020000006B-0000000000000000000000000000000000000000.gz
|
||||
00000001000000020000006C-0000000000000000000000000000000000000000.gz
|
||||
00000001000000020000006D-0000000000000000000000000000000000000000
|
||||
00000001000000020000006E-0000000000000000000000000000000000000000.gz
|
||||
00000001000000020000006F-0000000000000000000000000000000000000000.gz
|
||||
000000010000000200000070-0000000000000000000000000000000000000000
|
||||
000000010000000200000071-0000000000000000000000000000000000000000.gz
|
||||
|
||||
Use oldest full backup for archive retention
|
||||
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config="[TEST_PATH]/db-master/pgbackrest.conf" --stanza=db --log-level-console=detail --repo1-retention-full=10 --repo1-retention-diff=10 --repo1-retention-archive-type=full --repo1-retention-archive=10 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=10 --repo1-retention-archive-type=full --repo1-retention-diff=10 --repo1-retention-full=10 --stanza=db
|
||||
P00 INFO: full backup total < 10 - using oldest full backup for 9.2-1 archive retention
|
||||
P00 DETAIL: archive retention on backup [BACKUP-FULL-8], archiveId = 9.2-1, start = 000000010000000200000054
|
||||
P00 DETAIL: remove archive: archiveId = 9.2-1, start = 00000001000000020000002A, stop = 000000010000000200000050
|
||||
P00 INFO: expire command end: completed successfully
|
||||
|
||||
+ supplemental file: [TEST_PATH]/db-master/repo/backup/db/backup.info
|
||||
---------------------------------------------------------------------
|
||||
[backrest]
|
||||
backrest-format=5
|
||||
backrest-version="[VERSION-1]"
|
||||
|
||||
[backup:current]
|
||||
[BACKUP-FULL-8]={"backrest-format":5,"backrest-version":"[VERSION-1]","backup-archive-start":"000000010000000200000054","backup-archive-stop":"000000010000000200000056","backup-info-repo-size":[SIZE],"backup-info-repo-size-delta":[DELTA],"backup-info-size":[SIZE],"backup-info-size-delta":[DELTA],"backup-timestamp-start":[TIMESTAMP],"backup-timestamp-stop":[TIMESTAMP],"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}
|
||||
[BACKUP-INCR-4]={"backrest-format":5,"backrest-version":"[VERSION-1]","backup-archive-start":"00000001000000020000005A","backup-archive-stop":"00000001000000020000005C","backup-info-repo-size":[SIZE],"backup-info-repo-size-delta":[DELTA],"backup-info-size":[SIZE],"backup-info-size-delta":[DELTA],"backup-prior":"[BACKUP-FULL-8]","backup-reference":[],"backup-timestamp-start":[TIMESTAMP],"backup-timestamp-stop":[TIMESTAMP],"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}
|
||||
[BACKUP-FULL-9]={"backrest-format":5,"backrest-version":"[VERSION-1]","backup-archive-start":"000000010000000200000060","backup-archive-stop":"000000010000000200000062","backup-info-repo-size":[SIZE],"backup-info-repo-size-delta":[DELTA],"backup-info-size":[SIZE],"backup-info-size-delta":[DELTA],"backup-timestamp-start":[TIMESTAMP],"backup-timestamp-stop":[TIMESTAMP],"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}
|
||||
[BACKUP-DIFF-8]={"backrest-format":5,"backrest-version":"[VERSION-1]","backup-archive-start":"000000010000000200000066","backup-archive-stop":"000000010000000200000068","backup-info-repo-size":[SIZE],"backup-info-repo-size-delta":[DELTA],"backup-info-size":[SIZE],"backup-info-size-delta":[DELTA],"backup-prior":"[BACKUP-FULL-9]","backup-reference":[],"backup-timestamp-start":[TIMESTAMP],"backup-timestamp-stop":[TIMESTAMP],"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}
|
||||
[BACKUP-DIFF-9]={"backrest-format":5,"backrest-version":"[VERSION-1]","backup-archive-start":"00000001000000020000006C","backup-archive-stop":"00000001000000020000006E","backup-info-repo-size":[SIZE],"backup-info-repo-size-delta":[DELTA],"backup-info-size":[SIZE],"backup-info-size-delta":[DELTA],"backup-prior":"[BACKUP-FULL-9]","backup-reference":[],"backup-timestamp-start":[TIMESTAMP],"backup-timestamp-stop":[TIMESTAMP],"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}
|
||||
|
||||
[db]
|
||||
db-catalog-version=201204301
|
||||
db-control-version=922
|
||||
db-id=1
|
||||
db-system-id=1000000000000000092
|
||||
db-version="9.2"
|
||||
|
||||
[db:history]
|
||||
1={"db-catalog-version":201204301,"db-control-version":922,"db-system-id":1000000000000000092,"db-version":"9.2"}
|
||||
|
||||
[backrest]
|
||||
backrest-checksum="[CHECKSUM]"
|
||||
|
||||
> ls [TEST_PATH]/db-master/repo/backup/db | grep -v "backup.*"
|
||||
------------------------------------------------------------------------------------------------------------------------------------
|
||||
[BACKUP-FULL-8]
|
||||
[BACKUP-INCR-4]
|
||||
[BACKUP-FULL-9]
|
||||
[BACKUP-DIFF-8]
|
||||
[BACKUP-DIFF-9]
|
||||
|
||||
> ls -R [TEST_PATH]/db-master/repo/archive/db | grep -v "archive.info"
|
||||
------------------------------------------------------------------------------------------------------------------------------------
|
||||
[TEST_PATH]/db-master/repo/archive/db:
|
||||
|
||||
[TEST_PATH]/db-master/repo/archive/db/9.2-1:
|
||||
|
||||
[TEST_PATH]/db-master/repo/archive/db/9.2-1/0000000100000002:
|
||||
000000010000000200000054-0000000000000000000000000000000000000000.gz
|
||||
000000010000000200000055-0000000000000000000000000000000000000000
|
||||
000000010000000200000056-0000000000000000000000000000000000000000.gz
|
||||
000000010000000200000057-0000000000000000000000000000000000000000.gz
|
||||
000000010000000200000058-0000000000000000000000000000000000000000
|
||||
000000010000000200000059-0000000000000000000000000000000000000000.gz
|
||||
00000001000000020000005A-0000000000000000000000000000000000000000.gz
|
||||
00000001000000020000005B-0000000000000000000000000000000000000000
|
||||
00000001000000020000005C-0000000000000000000000000000000000000000.gz
|
||||
00000001000000020000005D-0000000000000000000000000000000000000000.gz
|
||||
00000001000000020000005E-0000000000000000000000000000000000000000
|
||||
00000001000000020000005F-0000000000000000000000000000000000000000.gz
|
||||
000000010000000200000060-0000000000000000000000000000000000000000.gz
|
||||
000000010000000200000061-0000000000000000000000000000000000000000
|
||||
000000010000000200000062-0000000000000000000000000000000000000000.gz
|
||||
000000010000000200000063-0000000000000000000000000000000000000000.gz
|
||||
000000010000000200000064-0000000000000000000000000000000000000000
|
||||
000000010000000200000065-0000000000000000000000000000000000000000.gz
|
||||
000000010000000200000066-0000000000000000000000000000000000000000.gz
|
||||
000000010000000200000067-0000000000000000000000000000000000000000
|
||||
000000010000000200000068-0000000000000000000000000000000000000000.gz
|
||||
000000010000000200000069-0000000000000000000000000000000000000000.gz
|
||||
00000001000000020000006A-0000000000000000000000000000000000000000
|
||||
00000001000000020000006B-0000000000000000000000000000000000000000.gz
|
||||
00000001000000020000006C-0000000000000000000000000000000000000000.gz
|
||||
00000001000000020000006D-0000000000000000000000000000000000000000
|
||||
00000001000000020000006E-0000000000000000000000000000000000000000.gz
|
||||
00000001000000020000006F-0000000000000000000000000000000000000000.gz
|
||||
000000010000000200000070-0000000000000000000000000000000000000000
|
||||
000000010000000200000071-0000000000000000000000000000000000000000.gz
|
||||
|
@ -306,8 +306,6 @@ P00 INFO: full backup size = 48MB
|
||||
P00 INFO: new backup label = [BACKUP-FULL-1]
|
||||
P00 INFO: backup command end: completed successfully
|
||||
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-full=2 --stanza=db
|
||||
P00 INFO: remove archive path: [TEST_PATH]/db-master/repo/archive/db/9.3-1
|
||||
P00 INFO: full backup total < 2 - using oldest full backup for 9.4-2 archive retention
|
||||
P00 INFO: expire command end: completed successfully
|
||||
|
||||
+ supplemental file: [TEST_PATH]/db-master/pgbackrest.conf
|
||||
@ -452,6 +450,7 @@ P00 INFO: full backup size = 48MB
|
||||
P00 INFO: new backup label = [BACKUP-FULL-2]
|
||||
P00 INFO: backup command end: completed successfully
|
||||
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-full=2 --stanza=db
|
||||
P00 INFO: remove archive path: [TEST_PATH]/db-master/repo/archive/db/9.3-1
|
||||
P00 INFO: expire command end: completed successfully
|
||||
|
||||
+ supplemental file: [TEST_PATH]/db-master/pgbackrest.conf
|
||||
|
@ -330,8 +330,6 @@ P00 DETAIL: tls statistics:[TLS-STATISTICS]
|
||||
P00 INFO: http statistics:[HTTP-STATISTICS]
|
||||
P00 INFO: backup command end: completed successfully
|
||||
P00 INFO: expire command begin [BACKREST-VERSION]: --buffer-size=[BUFFER-SIZE] --config=[TEST_PATH]/backup/pgbackrest.conf --lock-path=[TEST_PATH]/backup/lock --log-level-console=detail --log-level-file=[LOG-LEVEL-FILE] --log-level-stderr=off --log-path=[TEST_PATH]/backup/log[] --no-log-timestamp --pg1-host=db-master --pg1-host-cmd=[BACKREST-BIN] --pg1-host-config=[TEST_PATH]/db-master/pgbackrest.conf --pg1-host-user=[USER-1] --repo1-cipher-pass=<redacted> --repo1-cipher-type=aes-256-cbc --repo1-path=/ --repo1-retention-full=2 --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
|
||||
P00 INFO: remove archive path: /archive/db/9.3-1
|
||||
P00 INFO: full backup total < 2 - using oldest full backup for 9.4-2 archive retention
|
||||
P00 DETAIL: socket statistics:[SOCKET-STATISTICS]
|
||||
P00 DETAIL: tls statistics:[TLS-STATISTICS]
|
||||
P00 INFO: http statistics:[HTTP-STATISTICS]
|
||||
@ -539,6 +537,7 @@ P00 DETAIL: tls statistics:[TLS-STATISTICS]
|
||||
P00 INFO: http statistics:[HTTP-STATISTICS]
|
||||
P00 INFO: backup command end: completed successfully
|
||||
P00 INFO: expire command begin [BACKREST-VERSION]: --buffer-size=[BUFFER-SIZE] --config=[TEST_PATH]/backup/pgbackrest.conf --lock-path=[TEST_PATH]/backup/lock --log-level-console=detail --log-level-file=[LOG-LEVEL-FILE] --log-level-stderr=off --log-path=[TEST_PATH]/backup/log[] --no-log-timestamp --pg1-host=db-master --pg1-host-cmd=[BACKREST-BIN] --pg1-host-config=[TEST_PATH]/db-master/pgbackrest.conf --pg1-host-user=[USER-1] --repo1-cipher-pass=<redacted> --repo1-cipher-type=aes-256-cbc --repo1-path=/ --repo1-retention-full=2 --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
|
||||
P00 INFO: remove archive path: /archive/db/9.3-1
|
||||
P00 DETAIL: socket statistics:[SOCKET-STATISTICS]
|
||||
P00 DETAIL: tls statistics:[TLS-STATISTICS]
|
||||
P00 INFO: http statistics:[HTTP-STATISTICS]
|
||||
|
@ -153,10 +153,6 @@ sub run
|
||||
$oExpireTest->backupCreate($self->stanza(), CFGOPTVAL_BACKUP_TYPE_DIFF, $lBaseTime += SECONDS_PER_DAY);
|
||||
$oExpireTest->backupCreate($self->stanza(), CFGOPTVAL_BACKUP_TYPE_DIFF, $lBaseTime += SECONDS_PER_DAY);
|
||||
$oExpireTest->process($self->stanza(), undef, undef, CFGOPTVAL_BACKUP_TYPE_DIFF, undef, $strDescription);
|
||||
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
$strDescription = 'Use oldest full backup for archive retention';
|
||||
$oExpireTest->process($self->stanza(), 10, 10, CFGOPTVAL_BACKUP_TYPE_FULL, 10, $strDescription);
|
||||
}
|
||||
|
||||
############################################################################################################################
|
||||
|
@ -652,7 +652,11 @@ testRun(void)
|
||||
archiveGenerate(storageTest, archiveStanzaPath, 1, 10, "9.4-1", "0000000200000000");
|
||||
archiveGenerate(storageTest, archiveStanzaPath, 1, 10, "10-2", "0000000100000000");
|
||||
|
||||
TEST_RESULT_VOID(removeExpiredArchive(infoBackup), "archive retention type = full (default), repo1-retention-archive=4");
|
||||
argList = strLstDup(argListAvoidWarn);
|
||||
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_STR(
|
||||
strLstJoin(strLstSort(storageListP(
|
||||
@ -668,9 +672,6 @@ testRun(void)
|
||||
storageTest, strNewFmt("%s/%s/%s", strPtr(archiveStanzaPath), "10-2", "0000000100000000")), sortOrderAsc), ", "),
|
||||
archiveExpectList(3, 10, "0000000100000000"),
|
||||
"000000010000000000000001 and 000000010000000000000002 removed from 10-2/0000000100000000");
|
||||
harnessLogResult(
|
||||
"P00 INFO: full backup total < 4 - using oldest full backup for 9.4-1 archive retention\n"
|
||||
"P00 INFO: full backup total < 4 - using oldest full backup for 10-2 archive retention");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("retention-archive set - latest archive not expired");
|
||||
@ -1026,23 +1027,6 @@ testRun(void)
|
||||
storageTest, strNewFmt("%s/%s/%s", strPtr(archiveStanzaPath), "9.4-1", "0000000100000000")), sortOrderAsc), ", "),
|
||||
archiveExpectList(1, 5, "0000000100000000"), "nothing removed from 9.4-1/0000000100000000");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("retention-archive-type=incr");
|
||||
|
||||
argList = strLstDup(argListAvoidWarn);
|
||||
strLstAddZ(argList, "--repo1-retention-archive=4");
|
||||
strLstAddZ(argList, "--repo1-retention-archive-type=incr");
|
||||
harnessCfgLoad(cfgCmdExpire, argList);
|
||||
|
||||
TEST_RESULT_VOID(
|
||||
removeExpiredArchive(infoBackup), "full count as incr but not enough backups, retention set to first full");
|
||||
TEST_RESULT_STR(
|
||||
strLstJoin(strLstSort(storageListP(
|
||||
storageTest, strNewFmt("%s/%s/%s", strPtr(archiveStanzaPath), "9.4-1", "0000000100000000")), sortOrderAsc), ", "),
|
||||
archiveExpectList(2, 5, "0000000100000000"), "only removed archive prior to first full");
|
||||
harnessLogResult(
|
||||
"P00 INFO: full backup total < 4 - using oldest full backup for 9.4-1 archive retention");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("prior backup has no archive-start");
|
||||
|
||||
@ -1058,6 +1042,7 @@ testRun(void)
|
||||
"P00 DETAIL: archive retention on backup 20181119-152138F, archiveId = 9.4-1, start = 000000010000000000000002,"
|
||||
" stop = 000000010000000000000002\n"
|
||||
"P00 DETAIL: archive retention on backup 20181119-152900F, archiveId = 9.4-1, start = 000000010000000000000004\n"
|
||||
"P00 DETAIL: remove archive: archiveId = 9.4-1, start = 000000010000000000000001, stop = 000000010000000000000001\n"
|
||||
"P00 DETAIL: remove archive: archiveId = 9.4-1, start = 000000010000000000000003, stop = 000000010000000000000003");
|
||||
|
||||
harnessLogLevelReset();
|
||||
|
Loading…
Reference in New Issue
Block a user