1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-10-30 23:37:45 +02:00

Fix issue with adhoc expiration when no backups in a repository.

If there are no backups in one or more repositories then the following error occurs during adhoc expiration:

ASSERT: [025]: cannot get index 0 from list with 0 value(s)

Fix this by skipping the adhoc logic when there are no backups in a repository.
This commit is contained in:
David Steele
2025-06-24 12:35:18 -04:00
parent 3780057866
commit 638815b4cd
4 changed files with 26 additions and 1 deletions

View File

@@ -1,5 +1,20 @@
<release date="XXXX-XX-XX" version="2.56.0dev" title="UNDER DEVELOPMENT">
<release-core-list>
<release-bug-list>
<release-item>
<github-issue id="2645"/>
<github-pull-request id="2646"/>
<release-item-contributor-list>
<release-item-ideator id="anup.gupta"/>
<release-item-contributor id="david.steele"/>
<release-item-reviewer id="stefan.fercot"/>
</release-item-contributor-list>
<p>Fix issue with adhoc expiration when no backups in a repository.</p>
</release-item>
</release-bug-list>
<release-improvement-list>
<release-item>
<github-pull-request id="2642"/>

View File

@@ -115,6 +115,11 @@
<contributor-id type="github">woblerr</contributor-id>
</contributor>
<contributor id="anup.gupta">
<contributor-name-display>Anup Gupta</contributor-name-display>
<contributor-id type="github">anupg19</contributor-id>
</contributor>
<contributor id="argdenis">
<contributor-name-display>argdenis</contributor-name-display>
<contributor-id type="github">argdenis</contributor-id>

View File

@@ -829,7 +829,7 @@ removeExpiredBackup(const InfoBackup *const infoBackup, const String *const adho
unsigned int backupIdx = 0;
// Only remove the resumable backup if there is a possibility it is a dependent of the adhoc label being expired
if (adhocBackupLabel != NULL)
if (adhocBackupLabel != NULL && !strLstEmpty(backupList))
{
const String *const manifestFileName = strNewFmt(
STORAGE_REPO_BACKUP "/%s/" BACKUP_MANIFEST_FILE, strZ(strLstGet(backupList, backupIdx)));

View File

@@ -447,6 +447,11 @@ testRun(void)
"20181118-152100F_20181119-152152D.save\n"
BOGUS_STR "/\n"
"backup.info\n");
// -------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("skip adhoc when no backups");
TEST_RESULT_VOID(removeExpiredBackup(infoBackup, STRDEF("20181118-152100F"), 0), "expire");
}
// *****************************************************************************************************************************