1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-09-16 09:06:18 +02:00

Fix expire archive range logging.

The prior logging only output the last path to be removed since start was overwritten as each path was deleted. This had no affect on expire functionality but was confusing since many more files might be expired than the logs indicated.

Fix logging so the correct start path is logged.
This commit is contained in:
David Steele
2025-02-15 12:17:04 -05:00
committed by GitHub
parent ef0a71d629
commit 47f050f8fd
3 changed files with 22 additions and 4 deletions

View File

@@ -12,6 +12,19 @@
<p>Do not set <br-option>recovery_target_timeline=current</br-option> for PostgreSQL &amp;lt; 12.</p>
</release-item>
<release-item>
<github-issue id="2543"/>
<github-pull-request id="2554"/>
<release-item-contributor-list>
<release-item-ideator id="ales.zeleny"/>
<release-item-contributor id="david.steele"/>
<release-item-reviewer id="stefan.fercot"/>
</release-item-contributor-list>
<p>Fix expire archive range logging.</p>
</release-item>
<release-item>
<github-pull-request id="2539"/>

View File

@@ -678,8 +678,11 @@ removeExpiredArchive(const InfoBackup *const infoBackup, const bool timeBasedFul
}
archiveExpire.total++;
archiveExpire.start = strDup(walPath);
archiveExpire.stop = strDup(walPath);
// Update start for the first WAL path removed
if (archiveExpire.start == NULL)
archiveExpire.start = strDup(walPath);
}
// Else delete individual files instead if the major path is less than or equal to the most recent
// retention backup. This optimization prevents scanning though major paths that could not possibly

View File

@@ -760,6 +760,8 @@ testRun(void)
HRN_STORAGE_PUT_EMPTY(storageRepoWrite(), STORAGE_REPO_BACKUP "/20181119-152900F/" BACKUP_MANIFEST_FILE);
HRN_STORAGE_PUT_EMPTY(storageRepoWrite(), STORAGE_REPO_BACKUP "/20181119-152900F_20181119-152500I/" BACKUP_MANIFEST_FILE);
archiveGenerate(storageRepoWrite(), STORAGE_REPO_ARCHIVE, 1, 10, "9.4-1", "0000000100000001");
argList = strLstDup(argListBase);
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "2");
hrnCfgArgRawZ(argList, cfgOptRepoRetentionDiff, "3");
@@ -779,7 +781,7 @@ testRun(void)
TEST_RESULT_LOG(
"P00 INFO: [DRY-RUN] repo1: expire full backup 20181119-152138F\n"
"P00 INFO: [DRY-RUN] repo1: remove expired backup 20181119-152138F\n"
"P00 INFO: [DRY-RUN] repo1: 9.4-1 remove archive, start = 0000000100000000, stop = 0000000100000000\n"
"P00 INFO: [DRY-RUN] repo1: 9.4-1 remove archive, start = 0000000100000000, stop = 0000000100000001\n"
"P00 INFO: [DRY-RUN] repo1: 9.4-1 remove archive, start = 000000020000000000000008, stop = 000000020000000000000008\n"
"P00 INFO: [DRY-RUN] repo1: 10-2 no archive to remove");
@@ -831,7 +833,7 @@ testRun(void)
TEST_RESULT_LOG(
"P00 INFO: repo2: expire full backup 20181119-152138F\n"
"P00 INFO: repo2: remove expired backup 20181119-152138F\n"
"P00 INFO: repo2: 9.4-1 remove archive, start = 0000000100000000, stop = 0000000100000000\n"
"P00 INFO: repo2: 9.4-1 remove archive, start = 0000000100000000, stop = 0000000100000001\n"
"P00 INFO: repo2: 9.4-1 remove archive, start = 000000020000000000000008, stop = 000000020000000000000008\n"
"P00 INFO: repo2: 10-2 no archive to remove");
@@ -850,7 +852,7 @@ testRun(void)
TEST_RESULT_LOG(
"P00 INFO: repo1: expire full backup 20181119-152138F\n"
"P00 INFO: repo1: remove expired backup 20181119-152138F\n"
"P00 INFO: repo1: 9.4-1 remove archive, start = 0000000100000000, stop = 0000000100000000\n"
"P00 INFO: repo1: 9.4-1 remove archive, start = 0000000100000000, stop = 0000000100000001\n"
"P00 INFO: repo1: 9.4-1 remove archive, start = 000000020000000000000008, stop = 000000020000000000000008\n"
"P00 INFO: repo1: 10-2 no archive to remove");