You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-11-06 08:49:29 +02:00
Closed #93: The retention-archive option can now be be safely set to less than backup retention (retention-full or retention-diff) without also specifying archive-copy=n. The WAL required to make the backups that fall outside of archive retention consistent will be preserved in the archive. However, in this case PITR will still not be possible for backups that fall outside of archive retention.
This commit is contained in:
@@ -763,14 +763,14 @@ sub BackRestTestBackup_Test
|
||||
$oExpireTest->process($strStanza, 1, 1, BACKUP_TYPE_FULL, 1, $strDescription);
|
||||
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
$strDescription = 'Expire oldest diff backup';
|
||||
$strDescription = 'Expire oldest full backup';
|
||||
|
||||
$oExpireTest->backupCreate($strStanza, BACKUP_TYPE_DIFF, $lBaseTime += SECONDS_PER_DAY);
|
||||
$oExpireTest->backupCreate($strStanza, BACKUP_TYPE_DIFF, $lBaseTime += SECONDS_PER_DAY, 256);
|
||||
$oExpireTest->process($strStanza, 1, 1, BACKUP_TYPE_FULL, 1, $strDescription);
|
||||
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
$strDescription = 'Expire oldest full backup, archive expire does not fall on major segment boundary';
|
||||
$strDescription = 'Expire oldest diff backup, archive expire does not fall on major segment boundary';
|
||||
|
||||
$oExpireTest->backupCreate($strStanza, BACKUP_TYPE_FULL, $lBaseTime += SECONDS_PER_DAY);
|
||||
$oExpireTest->backupCreate($strStanza, BACKUP_TYPE_DIFF, $lBaseTime += SECONDS_PER_DAY, undef, 0);
|
||||
|
||||
@@ -304,8 +304,8 @@ Nothing to expire
|
||||
> [BACKREST_BIN] "--config=[TEST_PATH]/backrest/pg_backrest.conf" --stanza=db --log-level-console=info --retention-full=1 --retention-diff=1 --retention-archive-type=full --retention-archive=1 expire
|
||||
------------------------------------------------------------------------------------------------------------------------------------
|
||||
INFO: expire start: --no-compress --config=[TEST_PATH]/backrest/pg_backrest.conf --log-level-console=info --log-level-file=trace --repo-path=[TEST_PATH]/backrest --retention-archive=1 --retention-archive-type=full --retention-diff=1 --retention-full=1 --stanza=db
|
||||
INFO: archive retention from backup [BACKUP-FULL-1], start = 000000010000000000000000
|
||||
INFO: no WAL segments to expire
|
||||
INFO: archive retention on backup [BACKUP-FULL-1], start = 000000010000000000000000
|
||||
INFO: no archive to remove
|
||||
INFO: expire stop
|
||||
|
||||
+ supplemental file: [TEST_PATH]/backrest/backup/db/backup.info
|
||||
@@ -920,8 +920,8 @@ Expire oldest full backup, archive expire falls on segment major boundary
|
||||
INFO: expire full backup set: [BACKUP-FULL-1], [BACKUP-INCR-1]
|
||||
INFO: remove expired backup [BACKUP-INCR-1]
|
||||
INFO: remove expired backup [BACKUP-FULL-1]
|
||||
INFO: archive retention from backup [BACKUP-FULL-2], start = 000000010000000100000000
|
||||
INFO: expire WAL segments: start = 0000000100000000, stop = 0000000100000000
|
||||
INFO: archive retention on backup [BACKUP-FULL-2], start = 000000010000000100000000
|
||||
INFO: remove archive: start = 0000000100000000, stop = 0000000100000000
|
||||
INFO: expire stop
|
||||
|
||||
+ supplemental file: [TEST_PATH]/backrest/backup/db/backup.info
|
||||
@@ -1292,14 +1292,14 @@ db-version="9.2"
|
||||
00000001000000020000000E-0000000000000000000000000000000000000000
|
||||
00000001000000020000000F-0000000000000000000000000000000000000000.gz
|
||||
|
||||
Expire oldest diff backup
|
||||
Expire oldest full backup
|
||||
> [BACKREST_BIN] "--config=[TEST_PATH]/backrest/pg_backrest.conf" --stanza=db --log-level-console=info --retention-full=1 --retention-diff=1 --retention-archive-type=full --retention-archive=1 expire
|
||||
------------------------------------------------------------------------------------------------------------------------------------
|
||||
INFO: expire start: --no-compress --config=[TEST_PATH]/backrest/pg_backrest.conf --log-level-console=info --log-level-file=trace --repo-path=[TEST_PATH]/backrest --retention-archive=1 --retention-archive-type=full --retention-diff=1 --retention-full=1 --stanza=db
|
||||
INFO: expire diff backup [BACKUP-DIFF-1]
|
||||
INFO: remove expired backup [BACKUP-DIFF-1]
|
||||
INFO: archive retention from backup [BACKUP-FULL-2], start = 000000010000000100000000
|
||||
INFO: no WAL segments to expire
|
||||
INFO: archive retention on backup [BACKUP-FULL-2], start = 000000010000000100000000
|
||||
INFO: no archive to remove
|
||||
INFO: expire stop
|
||||
|
||||
+ supplemental file: [TEST_PATH]/backrest/backup/db/backup.info
|
||||
@@ -1964,15 +1964,17 @@ db-version="9.2"
|
||||
00000001000000020000001C-0000000000000000000000000000000000000000.gz
|
||||
00000001000000020000001D-0000000000000000000000000000000000000000.gz
|
||||
|
||||
Expire oldest full backup, archive expire does not fall on major segment boundary
|
||||
Expire oldest diff backup, archive expire does not fall on major segment boundary
|
||||
> [BACKREST_BIN] "--config=[TEST_PATH]/backrest/pg_backrest.conf" --stanza=db --log-level-console=info --retention-full=1 --retention-diff=1 --retention-archive-type=diff --retention-archive=1 expire
|
||||
------------------------------------------------------------------------------------------------------------------------------------
|
||||
INFO: expire start: --no-compress --config=[TEST_PATH]/backrest/pg_backrest.conf --log-level-console=info --log-level-file=trace --repo-path=[TEST_PATH]/backrest --retention-archive=1 --retention-archive-type=diff --retention-diff=1 --retention-full=1 --stanza=db
|
||||
INFO: expire full backup set: [BACKUP-FULL-2], [BACKUP-DIFF-2]
|
||||
INFO: remove expired backup [BACKUP-DIFF-2]
|
||||
INFO: remove expired backup [BACKUP-FULL-2]
|
||||
INFO: archive retention from backup [BACKUP-DIFF-3], start = 000000010000000200000016
|
||||
INFO: expire WAL segments: start = 0000000100000001, stop = 000000010000000200000015
|
||||
INFO: archive retention on backup [BACKUP-FULL-3], start = 000000010000000200000010, stop = 000000010000000200000012
|
||||
INFO: archive retention on backup [BACKUP-DIFF-3], start = 000000010000000200000016
|
||||
INFO: remove archive: start = 0000000100000001, stop = 00000001000000020000000F
|
||||
INFO: remove archive: start = 000000010000000200000013, stop = 000000010000000200000015
|
||||
INFO: expire stop
|
||||
|
||||
+ supplemental file: [TEST_PATH]/backrest/backup/db/backup.info
|
||||
@@ -2022,6 +2024,9 @@ db-version="9.2"
|
||||
0000000100000002
|
||||
|
||||
[TEST_PATH]/backrest/archive/db/9.2-1/0000000100000002:
|
||||
000000010000000200000010-0000000000000000000000000000000000000000.gz
|
||||
000000010000000200000011-0000000000000000000000000000000000000000
|
||||
000000010000000200000012-0000000000000000000000000000000000000000.gz
|
||||
000000010000000200000016-0000000000000000000000000000000000000000.gz
|
||||
000000010000000200000017-0000000000000000000000000000000000000000
|
||||
000000010000000200000018-0000000000000000000000000000000000000000.gz
|
||||
@@ -2084,6 +2089,9 @@ db-version="9.2"
|
||||
0000000100000002
|
||||
|
||||
[TEST_PATH]/backrest/archive/db/9.2-1/0000000100000002:
|
||||
000000010000000200000010-0000000000000000000000000000000000000000.gz
|
||||
000000010000000200000011-0000000000000000000000000000000000000000
|
||||
000000010000000200000012-0000000000000000000000000000000000000000.gz
|
||||
000000010000000200000016-0000000000000000000000000000000000000000.gz
|
||||
000000010000000200000017-0000000000000000000000000000000000000000
|
||||
000000010000000200000018-0000000000000000000000000000000000000000.gz
|
||||
@@ -2106,8 +2114,9 @@ Expire oldest diff backup (cascade to incr)
|
||||
INFO: expire diff backup set: [BACKUP-DIFF-3], [BACKUP-INCR-2]
|
||||
INFO: remove expired backup [BACKUP-INCR-2]
|
||||
INFO: remove expired backup [BACKUP-DIFF-3]
|
||||
INFO: archive retention from backup [BACKUP-DIFF-4], start = 00000001000000020000001E
|
||||
INFO: expire WAL segments: start = 000000010000000200000016, stop = 00000001000000020000001D
|
||||
INFO: archive retention on backup [BACKUP-FULL-3], start = 000000010000000200000010, stop = 000000010000000200000012
|
||||
INFO: archive retention on backup [BACKUP-DIFF-4], start = 00000001000000020000001E
|
||||
INFO: remove archive: start = 000000010000000200000016, stop = 00000001000000020000001D
|
||||
INFO: expire stop
|
||||
|
||||
+ supplemental file: [TEST_PATH]/backrest/backup/db/backup.info
|
||||
@@ -2156,6 +2165,9 @@ db-version="9.2"
|
||||
0000000100000002
|
||||
|
||||
[TEST_PATH]/backrest/archive/db/9.2-1/0000000100000002:
|
||||
000000010000000200000010-0000000000000000000000000000000000000000.gz
|
||||
000000010000000200000011-0000000000000000000000000000000000000000
|
||||
000000010000000200000012-0000000000000000000000000000000000000000.gz
|
||||
00000001000000020000001E-0000000000000000000000000000000000000000.gz
|
||||
00000001000000020000001F-0000000000000000000000000000000000000000
|
||||
000000010000000200000020-0000000000000000000000000000000000000000.gz
|
||||
@@ -2215,6 +2227,9 @@ db-version="9.2"
|
||||
0000000100000002
|
||||
|
||||
[TEST_PATH]/backrest/archive/db/9.2-1/0000000100000002:
|
||||
000000010000000200000010-0000000000000000000000000000000000000000.gz
|
||||
000000010000000200000011-0000000000000000000000000000000000000000
|
||||
000000010000000200000012-0000000000000000000000000000000000000000.gz
|
||||
00000001000000020000001E-0000000000000000000000000000000000000000.gz
|
||||
00000001000000020000001F-0000000000000000000000000000000000000000
|
||||
000000010000000200000020-0000000000000000000000000000000000000000.gz
|
||||
@@ -2232,8 +2247,10 @@ Expire archive based on newest incr backup
|
||||
> [BACKREST_BIN] "--config=[TEST_PATH]/backrest/pg_backrest.conf" --stanza=db --log-level-console=info --retention-full=1 --retention-diff=1 --retention-archive-type=incr --retention-archive=1 expire
|
||||
------------------------------------------------------------------------------------------------------------------------------------
|
||||
INFO: expire start: --no-compress --config=[TEST_PATH]/backrest/pg_backrest.conf --log-level-console=info --log-level-file=trace --repo-path=[TEST_PATH]/backrest --retention-archive=1 --retention-archive-type=incr --retention-diff=1 --retention-full=1 --stanza=db
|
||||
INFO: archive retention from backup [BACKUP-INCR-3], start = 000000010000000200000024
|
||||
INFO: expire WAL segments: start = 00000001000000020000001E, stop = 000000010000000200000023
|
||||
INFO: archive retention on backup [BACKUP-FULL-3], start = 000000010000000200000010, stop = 000000010000000200000012
|
||||
INFO: archive retention on backup [BACKUP-DIFF-4], start = 00000001000000020000001E, stop = 000000010000000200000020
|
||||
INFO: archive retention on backup [BACKUP-INCR-3], start = 000000010000000200000024
|
||||
INFO: remove archive: start = 000000010000000200000021, stop = 000000010000000200000023
|
||||
INFO: expire stop
|
||||
|
||||
+ supplemental file: [TEST_PATH]/backrest/backup/db/backup.info
|
||||
@@ -2285,6 +2302,12 @@ db-version="9.2"
|
||||
0000000100000002
|
||||
|
||||
[TEST_PATH]/backrest/archive/db/9.2-1/0000000100000002:
|
||||
000000010000000200000010-0000000000000000000000000000000000000000.gz
|
||||
000000010000000200000011-0000000000000000000000000000000000000000
|
||||
000000010000000200000012-0000000000000000000000000000000000000000.gz
|
||||
00000001000000020000001E-0000000000000000000000000000000000000000.gz
|
||||
00000001000000020000001F-0000000000000000000000000000000000000000
|
||||
000000010000000200000020-0000000000000000000000000000000000000000.gz
|
||||
000000010000000200000024-0000000000000000000000000000000000000000.gz
|
||||
000000010000000200000025-0000000000000000000000000000000000000000
|
||||
000000010000000200000026-0000000000000000000000000000000000000000.gz
|
||||
|
||||
Reference in New Issue
Block a user