mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-04-17 11:46:39 +02:00
Allow const checksum buffers to be returned from backupFile().
This allows less duplication of buffers. For delta check return file->pgFileSize/file->pgFileChecksum instead of pgTestSize/pgTestChecksum since this saves one buffer duplication and we know these values are equal since we just checked them. Also add an assert to ensure copyChecksum is valid relative to size.
This commit is contained in:
parent
4f760df417
commit
c8795094d4
@ -38,7 +38,10 @@
|
||||
</release-item>
|
||||
|
||||
<release-item>
|
||||
<github-pull-request id="2227"/>
|
||||
<commit subject="Skip files truncated during backup when bundling.">
|
||||
<github-pull-request id="2227"/>
|
||||
</commit>
|
||||
<commit subject="Allow const checksum buffers to be returned from backupFile()."/>
|
||||
|
||||
<release-item-contributor-list>
|
||||
<release-item-contributor id="georgy.shelkovy"/>
|
||||
|
@ -115,8 +115,8 @@ backupFile(
|
||||
MEM_CONTEXT_BEGIN(lstMemContext(result))
|
||||
{
|
||||
fileResult->backupCopyResult = backupCopyResultNoOp;
|
||||
fileResult->copySize = pgTestSize;
|
||||
fileResult->copyChecksum = bufDup(pgTestChecksum);
|
||||
fileResult->copySize = file->pgFileSize;
|
||||
fileResult->copyChecksum = file->pgFileChecksum;
|
||||
}
|
||||
MEM_CONTEXT_END();
|
||||
}
|
||||
@ -164,7 +164,7 @@ backupFile(
|
||||
{
|
||||
fileResult->backupCopyResult = backupCopyResultChecksum;
|
||||
fileResult->copySize = file->pgFileSize;
|
||||
fileResult->copyChecksum = bufDup(file->pgFileChecksum);
|
||||
fileResult->copyChecksum = file->pgFileChecksum;
|
||||
}
|
||||
MEM_CONTEXT_END();
|
||||
}
|
||||
|
@ -54,8 +54,8 @@ typedef struct BackupFileResult
|
||||
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.)
|
||||
const Buffer *copyChecksum; // Checksum of pg file
|
||||
const Buffer *repoChecksum; // Checksum of repo file (including compression, etc.)
|
||||
uint64_t bundleOffset; // Offset in bundle if any
|
||||
uint64_t repoSize;
|
||||
uint64_t blockIncrMapSize; // Size of block incremental map (0 if no map)
|
||||
|
@ -5,6 +5,7 @@ Backup Protocol Handler
|
||||
|
||||
#include "command/backup/file.h"
|
||||
#include "command/backup/protocol.h"
|
||||
#include "common/crypto/hash.h"
|
||||
#include "common/debug.h"
|
||||
#include "common/io/io.h"
|
||||
#include "common/log.h"
|
||||
@ -88,6 +89,10 @@ backupFileProtocol(PackRead *const param, ProtocolServer *const server)
|
||||
{
|
||||
const BackupFileResult *const fileResult = lstGet(result, resultIdx);
|
||||
|
||||
ASSERT(
|
||||
fileResult->backupCopyResult == backupCopyResultSkip || fileResult->copySize != 0 ||
|
||||
bufEq(fileResult->copyChecksum, HASH_TYPE_SHA1_ZERO_BUF));
|
||||
|
||||
pckWriteStrP(resultPack, fileResult->manifestFile);
|
||||
pckWriteU32P(resultPack, fileResult->backupCopyResult);
|
||||
pckWriteBoolP(resultPack, fileResult->repoInvalid);
|
||||
|
Loading…
x
Reference in New Issue
Block a user