1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-04-15 11:36:40 +02:00

Log when file size changes during backup.

It is possible for the size of a file to change during the backup. In most cases we won't notice since files sizes are usually capped but it is possible for some files to grow or shrink between when they are recorded in the manifest and when they are actually copied. The new size is recorded in the manifest but the old size may be useful for debugging.

The new code has coverage but no test changes because it is covered by the parallel backup testing, which does not have deterministic log output. It doesn't seem worth creating a new test to check the log format as it is not very critical (though the output was manually verified).
This commit is contained in:
David Steele 2023-07-13 13:47:27 +03:00
parent b6b13bd634
commit c9703b3530

View File

@ -1438,6 +1438,10 @@ backupJobResult(
if (bundleId != 0 && copyResult != backupCopyResultNoOp)
strCatFmt(logProgress, "bundle %" PRIu64 "/%" PRIu64 ", ", bundleId, bundleOffset);
// Log original manifest size if copy size differs
if (copySize != file.size)
strCatFmt(logProgress, "%s->", strZ(strSizeFormat(file.size)));
// Store percentComplete as an integer
percentComplete = sizeTotal == 0 ? 10000 : (unsigned int)(((double)*sizeProgress / (double)sizeTotal) * 10000);