You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-07-15 01:04:37 +02:00
Recopy during backup when resumed file is missing or corrupt.
A recopy would occur if the size or checksum was invalid but on error the backup would terminate. Instead, recopy the resumed file on any error. If the error is systemic (e.g. network failure) then it should show up again during the recopy.
This commit is contained in:
@ -132,6 +132,10 @@ backupFile(
|
||||
storageRemoveP(storageRepoWrite(), repoPathFile);
|
||||
}
|
||||
else if (!delta || pgFileMatch)
|
||||
{
|
||||
// Check the repo file in a try block because on error (e.g. missing or corrupt file that can't be decrypted or
|
||||
// decompressed) we should recopy rather than ending the backup.
|
||||
TRY_BEGIN()
|
||||
{
|
||||
// Generate checksum/size for the repo file
|
||||
IoRead *read = storageReadIo(storageNewReadP(storageRepo(), repoPathFile));
|
||||
@ -168,6 +172,13 @@ backupFile(
|
||||
else
|
||||
result.backupCopyResult = backupCopyResultReCopy;
|
||||
}
|
||||
// Recopy on any kind of error
|
||||
CATCH_ANY()
|
||||
{
|
||||
result.backupCopyResult = backupCopyResultReCopy;
|
||||
}
|
||||
TRY_END();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -234,6 +234,22 @@ testRun(void)
|
||||
storageExistsP(storageRepo(), backupPathFile) && result.pageChecksumResult == NULL),
|
||||
true, " copy");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("resumed file is missing in repo but present in resumed manfest, recopy");
|
||||
|
||||
TEST_ASSIGN(
|
||||
result,
|
||||
backupFile(
|
||||
pgFile, false, 9, strNew("9bc8ab2dda60ef4beed07d1e19ce0676d5edde67"), false, 0, STRDEF(BOGUS_STR), false, false, 1,
|
||||
backupLabel, true, cipherTypeNone, NULL),
|
||||
"backup file");
|
||||
TEST_RESULT_UINT(result.copySize + result.repoSize, 18, " copy=repo=pgFile size");
|
||||
TEST_RESULT_UINT(result.backupCopyResult, backupCopyResultReCopy, " check copy result");
|
||||
TEST_RESULT_BOOL(
|
||||
(strEqZ(result.copyChecksum, "9bc8ab2dda60ef4beed07d1e19ce0676d5edde67") &&
|
||||
storageExistsP(storageRepo(), backupPathFile) && result.pageChecksumResult == NULL),
|
||||
true, " recopy");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
// File exists in repo and db, checksum not same in repo, delta set, ignoreMissing false, no hasReference - RECOPY
|
||||
TEST_RESULT_VOID(
|
||||
|
Reference in New Issue
Block a user