mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2024-12-12 10:04:14 +02:00
Consistently declare block incremental size as size_t.
The block is often allocated in memory so size_t makes more sense than uint64_t.
This commit is contained in:
parent
d520816acf
commit
779efe0d7a
@ -21,6 +21,7 @@
|
||||
<commit subject="Add block incremental to real/all test output."/>
|
||||
<commit subject="Improve IoChunkedRead end-of-file handling."/>
|
||||
<commit subject="Remove parameter list from deltaMapNew()."/>
|
||||
<commit subject="Consistently declare block incremental size as size_t."/>
|
||||
|
||||
<release-item-contributor-list>
|
||||
<release-item-contributor id="david.steele"/>
|
||||
|
@ -425,8 +425,8 @@ blockIncrNewPack(const Pack *const paramList)
|
||||
PackRead *const paramListPack = pckReadNew(paramList);
|
||||
const size_t blockSize = (size_t)pckReadU64P(paramListPack);
|
||||
const unsigned int reference = pckReadU32P(paramListPack);
|
||||
const uint64_t bundleId = (size_t)pckReadU64P(paramListPack);
|
||||
const uint64_t bundleOffset = (size_t)pckReadU64P(paramListPack);
|
||||
const uint64_t bundleId = pckReadU64P(paramListPack);
|
||||
const uint64_t bundleOffset = pckReadU64P(paramListPack);
|
||||
const Buffer *blockMapPrior = pckReadBinP(paramListPack);
|
||||
|
||||
// Create compress filter
|
||||
|
@ -250,8 +250,7 @@ backupFile(
|
||||
ioFilterGroupAdd(
|
||||
ioReadFilterGroup(storageReadIo(read)),
|
||||
blockIncrNew(
|
||||
(size_t)file->blockIncrSize, blockIncrReference, bundleId, bundleOffset, blockMap, compress,
|
||||
encrypt));
|
||||
file->blockIncrSize, blockIncrReference, bundleId, bundleOffset, blockMap, compress, encrypt));
|
||||
|
||||
repoChecksum = true;
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ typedef struct BackupFile
|
||||
bool pgFileCopyExactSize; // Copy only pg expected size
|
||||
const Buffer *pgFileChecksum; // Expected pg file checksum
|
||||
bool pgFileChecksumPage; // Validate page checksums?
|
||||
uint64_t blockIncrSize; // Perform block incremental on this file?
|
||||
size_t blockIncrSize; // Perform block incremental on this file?
|
||||
const String *blockIncrMapPriorFile; // File containing prior block incremental map (NULL if none)
|
||||
uint64_t blockIncrMapPriorOffset; // Offset of prior block incremental map
|
||||
uint64_t blockIncrMapPriorSize; // Size of prior block incremental map
|
||||
|
@ -48,7 +48,7 @@ backupFileProtocol(PackRead *const param, ProtocolServer *const server)
|
||||
file.pgFileCopyExactSize = pckReadBoolP(param);
|
||||
file.pgFileChecksum = pckReadBinP(param);
|
||||
file.pgFileChecksumPage = pckReadBoolP(param);
|
||||
file.blockIncrSize = pckReadU64P(param);
|
||||
file.blockIncrSize = (size_t)pckReadU64P(param);
|
||||
|
||||
if (file.blockIncrSize > 0)
|
||||
{
|
||||
|
@ -124,7 +124,7 @@ restoreFile(
|
||||
|
||||
// Generate delta map if block incremental
|
||||
if (file->blockIncrMapSize != 0)
|
||||
ioFilterGroupAdd(ioReadFilterGroup(read), deltaMapNew((size_t)file->blockIncrSize));
|
||||
ioFilterGroupAdd(ioReadFilterGroup(read), deltaMapNew(file->blockIncrSize));
|
||||
|
||||
ioReadDrain(read);
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ typedef struct RestoreFile
|
||||
uint64_t offset; // Offset into repo file where pg file is located
|
||||
const Variant *limit; // Limit for read in the repo file
|
||||
uint64_t blockIncrMapSize; // Block incremental map size (0 if not incremental)
|
||||
uint64_t blockIncrSize; // Block incremental size (when map size > 0)
|
||||
size_t blockIncrSize; // Block incremental size (when map size > 0)
|
||||
const String *manifestFile; // Manifest file
|
||||
const Buffer *deltaMap; // Delta for block incremental restore, set in restoreFile()
|
||||
} RestoreFile;
|
||||
|
@ -60,7 +60,7 @@ restoreFileProtocol(PackRead *const param, ProtocolServer *const server)
|
||||
file.blockIncrMapSize = pckReadU64P(param);
|
||||
|
||||
if (file.blockIncrMapSize != 0)
|
||||
file.blockIncrSize = pckReadU64P(param);
|
||||
file.blockIncrSize = (size_t)pckReadU64P(param);
|
||||
|
||||
file.manifestFile = pckReadStrP(param);
|
||||
|
||||
|
@ -365,7 +365,8 @@ manifestFileUnpack(const Manifest *const manifest, const ManifestFilePack *const
|
||||
// Block incremental
|
||||
if (flag & (1 << manifestFilePackFlagBlockIncr))
|
||||
{
|
||||
result.blockIncrSize = cvtUInt64FromVarInt128((const uint8_t *)filePack, &bufferPos, UINT_MAX) * BLOCK_INCR_SIZE_FACTOR;
|
||||
result.blockIncrSize =
|
||||
(size_t)cvtUInt64FromVarInt128((const uint8_t *)filePack, &bufferPos, UINT_MAX) * BLOCK_INCR_SIZE_FACTOR;
|
||||
result.blockIncrMapSize = cvtUInt64FromVarInt128((const uint8_t *)filePack, &bufferPos, UINT_MAX);
|
||||
}
|
||||
|
||||
@ -789,7 +790,7 @@ static struct ManifestBuildBlockIncrTimeMap
|
||||
{.fileAge = 7 * 86400, .blockMultiplier = 2},
|
||||
};
|
||||
|
||||
static uint64_t
|
||||
static size_t
|
||||
manifestBuildBlockIncrSize(const time_t timeStart, const ManifestFile *const file)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
@ -797,7 +798,7 @@ manifestBuildBlockIncrSize(const time_t timeStart, const ManifestFile *const fil
|
||||
FUNCTION_TEST_PARAM(MANIFEST_FILE, file);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
uint64_t result = 0;
|
||||
size_t result = 0;
|
||||
|
||||
// Search size map for the appropriate block size
|
||||
for (unsigned int sizeIdx = 0; sizeIdx < LENGTH_OF(manifestBuildBlockIncrSizeMap); sizeIdx++)
|
||||
@ -1966,7 +1967,7 @@ manifestLoadCallback(void *callbackData, const String *const section, const Stri
|
||||
file.blockIncrMapSize = jsonReadUInt64(json);
|
||||
|
||||
if (jsonReadKeyExpectStrId(json, MANIFEST_KEY_BLOCK_INCR_SIZE))
|
||||
file.blockIncrSize = jsonReadUInt64(json) * BLOCK_INCR_SIZE_FACTOR;
|
||||
file.blockIncrSize = (size_t)jsonReadUInt64(json) * BLOCK_INCR_SIZE_FACTOR;
|
||||
|
||||
// Bundle info
|
||||
if (jsonReadKeyExpectStrId(json, MANIFEST_KEY_BUNDLE_ID))
|
||||
|
@ -116,7 +116,7 @@ typedef struct ManifestFile
|
||||
const String *reference; // Reference to a prior backup
|
||||
uint64_t bundleId; // Bundle id
|
||||
uint64_t bundleOffset; // Bundle offset
|
||||
uint64_t blockIncrSize; // Size of incremental blocks
|
||||
size_t blockIncrSize; // Size of incremental blocks
|
||||
uint64_t blockIncrMapSize; // Block incremental map size
|
||||
uint64_t size; // Original size
|
||||
uint64_t sizeRepo; // Size in repo
|
||||
|
@ -42,7 +42,7 @@ typedef struct HrnManifestFile
|
||||
const char *reference;
|
||||
uint64_t bundleId;
|
||||
uint64_t bundleOffset;
|
||||
uint64_t blockIncrSize;
|
||||
size_t blockIncrSize;
|
||||
uint64_t blockIncrMapSize;
|
||||
uint64_t size;
|
||||
uint64_t sizeRepo;
|
||||
|
Loading…
Reference in New Issue
Block a user