mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2024-12-12 10:04:14 +02:00
Add block incremental info to restore detail logging.
Log that block incremental was used and the delta size if less than the entire file was updated.
This commit is contained in:
parent
d27533b40f
commit
88edea4571
@ -215,7 +215,7 @@ restoreFile(
|
||||
MEM_CONTEXT_TEMP_BEGIN()
|
||||
{
|
||||
const RestoreFile *const file = lstGet(fileList, fileIdx);
|
||||
const RestoreFileResult *const fileResult = lstGet(result, fileIdx);
|
||||
RestoreFileResult *const fileResult = lstGet(result, fileIdx);
|
||||
|
||||
// Copy file from repository to database
|
||||
if (fileResult->result == restoreResultCopy)
|
||||
@ -336,6 +336,7 @@ restoreFile(
|
||||
|
||||
// Write block
|
||||
ioWrite(storageWriteIo(pgFileWrite), deltaWrite->block);
|
||||
fileResult->blockIncrDeltaSize += bufUsed(deltaWrite->block);
|
||||
|
||||
// Flush writes since we may seek to a new location for the next block
|
||||
ioWriteFlush(storageWriteIo(pgFileWrite));
|
||||
|
@ -44,6 +44,7 @@ typedef struct RestoreFileResult
|
||||
{
|
||||
const String *manifestFile; // Manifest file
|
||||
RestoreResult result; // Restore result (e.g. preserve, copy)
|
||||
uint64_t blockIncrDeltaSize; // Size restored by block incremental delta
|
||||
} RestoreFileResult;
|
||||
|
||||
FN_EXTERN List *restoreFile(
|
||||
|
@ -85,6 +85,7 @@ restoreFileProtocol(PackRead *const param, ProtocolServer *const server)
|
||||
|
||||
pckWriteStrP(resultPack, fileResult->manifestFile);
|
||||
pckWriteU32P(resultPack, fileResult->result);
|
||||
pckWriteU64P(resultPack, fileResult->blockIncrDeltaSize);
|
||||
}
|
||||
|
||||
protocolServerDataPut(server, resultPack);
|
||||
|
@ -2170,6 +2170,7 @@ restoreJobResult(const Manifest *manifest, ProtocolParallelJob *job, RegExp *zer
|
||||
const ManifestFile file = manifestFileFind(manifest, pckReadStrP(jobResult));
|
||||
const bool zeroed = restoreFileZeroed(file.name, zeroExp);
|
||||
const RestoreResult result = (RestoreResult)pckReadU32P(jobResult);
|
||||
const uint64_t blockIncrDeltaSize = pckReadU64P(jobResult);
|
||||
|
||||
String *log = strCatZ(strNew(), "restore");
|
||||
|
||||
@ -2223,6 +2224,15 @@ restoreJobResult(const Manifest *manifest, ProtocolParallelJob *job, RegExp *zer
|
||||
strCatFmt(log, "%" PRIu64 "/%" PRIu64 ", ", file.bundleId, file.bundleOffset);
|
||||
}
|
||||
|
||||
// Add block incremental delta size, i.e. amount of the file that block incremental updated
|
||||
if (file.blockIncrMapSize != 0 && result != restoreResultPreserve)
|
||||
{
|
||||
strCatZ(log, "bi ");
|
||||
|
||||
if (blockIncrDeltaSize != file.size)
|
||||
strCatFmt(log, "%s/", strZ(strSizeFormat(blockIncrDeltaSize)));
|
||||
}
|
||||
|
||||
// Add size and percent complete
|
||||
sizeRestored += file.size;
|
||||
strCatFmt(log, "%s, %.2lf%%)", strZ(strSizeFormat(file.size)), (double)sizeRestored * 100.00 / (double)sizeTotal);
|
||||
|
@ -2800,11 +2800,11 @@ testRun(void)
|
||||
"P00 DETAIL: create symlink '" TEST_PATH "/pg/pg_xact' to '../xact'\n"
|
||||
"P00 DETAIL: create symlink '" TEST_PATH "/pg/pg_hba.conf' to '../config/pg_hba.conf'\n"
|
||||
"P00 DETAIL: create symlink '" TEST_PATH "/pg/postgresql.conf' to '../config/postgresql.conf'\n"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/base/1/bi-unused-ref (48KB, [PCT]) checksum"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/base/1/bi-unused-ref (bi 24KB/48KB, [PCT]) checksum"
|
||||
" febd680181d4cd315dce942348862c25fbd731f3\n"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/base/32768/32769 (32KB, [PCT]) checksum"
|
||||
" a40f0986acb1531ce0cc75a23dcf8aa406ae9081\n"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/base/1/bi-no-ref (24KB, [PCT]) checksum"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/base/1/bi-no-ref (bi 24KB, [PCT]) checksum"
|
||||
" 953cdcc904c5d4135d96fc0833f121bf3033c74c\n"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/base/16384/16385 (16KB, [PCT]) checksum"
|
||||
" d74e5f7ebe52a3ed468ba08c5b6aefaccd1ca88f\n"
|
||||
|
Loading…
Reference in New Issue
Block a user