Skip to content

Commit

Permalink
Log when file size changes during backup.
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
dwsteele committed Jul 13, 2023
1 parent b6b13bd commit c9703b3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/command/backup/backup.c
Expand Up @@ -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);

Expand Down

0 comments on commit c9703b3

Please sign in to comment.