mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-01-18 04:58:51 +02:00
Refactor backupFile() to remove backupCopyResultReCopy.
Having two enum values for file copy makes things a bit more complicated than they need to be (especially in an upcoming commit). Instead add a flag to indicate that the repository file was invalid since the only purpose is to trigger a warning message.
This commit is contained in:
parent
a42614e8f3
commit
701865eca1
@ -1421,6 +1421,7 @@ backupJobResult(
|
||||
{
|
||||
ManifestFile file = manifestFileFind(manifest, pckReadStrP(jobResult));
|
||||
const BackupCopyResult copyResult = (BackupCopyResult)pckReadU32P(jobResult);
|
||||
const bool repoInvalid = pckReadBoolP(jobResult);
|
||||
const uint64_t copySize = pckReadU64P(jobResult);
|
||||
const uint64_t bundleOffset = pckReadU64P(jobResult);
|
||||
const uint64_t blockIncrMapSize = pckReadU64P(jobResult);
|
||||
@ -1482,8 +1483,10 @@ backupJobResult(
|
||||
// If the file had to be recopied then warn that there may be an issue with corruption in the repository
|
||||
// ??? This should really be below the message below for more context -- can be moved after the migration
|
||||
// ??? The name should be a pg path not manifest name -- can be fixed after the migration
|
||||
if (copyResult == backupCopyResultReCopy)
|
||||
if (repoInvalid)
|
||||
{
|
||||
ASSERT(copyResult == backupCopyResultCopy);
|
||||
|
||||
LOG_WARN_FMT(
|
||||
"resumed backup file %s does not have expected checksum %s. The file will be recopied and backup will"
|
||||
" continue but this may be an issue unless the resumed backup path in the repository is known to be"
|
||||
|
@ -168,9 +168,9 @@ backupFile(
|
||||
}
|
||||
MEM_CONTEXT_END();
|
||||
}
|
||||
// Else recopy when repo file is not as expected
|
||||
// Else copy when repo file is invalid
|
||||
else
|
||||
fileResult->backupCopyResult = backupCopyResultReCopy;
|
||||
fileResult->repoInvalid = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -192,7 +192,7 @@ backupFile(
|
||||
const BackupFile *const file = lstGet(fileList, fileIdx);
|
||||
BackupFileResult *const fileResult = lstGet(result, fileIdx);
|
||||
|
||||
if (fileResult->backupCopyResult == backupCopyResultCopy || fileResult->backupCopyResult == backupCopyResultReCopy)
|
||||
if (fileResult->backupCopyResult == backupCopyResultCopy)
|
||||
{
|
||||
// Setup pg file for read. Only read as many bytes as passed in pgFileSize. If the file is growing it does no
|
||||
// good to copy data past the end of the size recorded in the manifest since those blocks will need to be
|
||||
|
@ -16,7 +16,6 @@ typedef enum
|
||||
{
|
||||
backupCopyResultChecksum,
|
||||
backupCopyResultCopy,
|
||||
backupCopyResultReCopy,
|
||||
backupCopyResultSkip,
|
||||
backupCopyResultNoOp,
|
||||
backupCopyResultTruncate,
|
||||
@ -53,6 +52,7 @@ typedef struct BackupFileResult
|
||||
{
|
||||
const String *manifestFile; // Manifest file
|
||||
BackupCopyResult backupCopyResult;
|
||||
bool repoInvalid; // File was recopied because repo file was invalid
|
||||
uint64_t copySize;
|
||||
Buffer *copyChecksum;
|
||||
Buffer *repoChecksum; // Checksum repo file (including compression, etc.)
|
||||
|
@ -90,6 +90,7 @@ backupFileProtocol(PackRead *const param, ProtocolServer *const server)
|
||||
|
||||
pckWriteStrP(resultPack, fileResult->manifestFile);
|
||||
pckWriteU32P(resultPack, fileResult->backupCopyResult);
|
||||
pckWriteBoolP(resultPack, fileResult->repoInvalid);
|
||||
pckWriteU64P(resultPack, fileResult->copySize);
|
||||
pckWriteU64P(resultPack, fileResult->bundleOffset);
|
||||
pckWriteU64P(resultPack, fileResult->blockIncrMapSize);
|
||||
|
Loading…
Reference in New Issue
Block a user