1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-14 10:13:05 +02:00
pgbackrest/test
Georgy Shelkovy 02eea555c7
Skip files truncated during backup when bundling.
In bundle mode pgBackRest skips files of zero size, that is, it does not queue them for copying.

After splitting the files into bundles, pgBackRest launches one or more processes that directly perform the backup, namely, read the files and, if necessary, write them to the bundles.

If during the time between the distribution of all files among bundles and the direct copying of a file to a bundle, this file of non-zero size was truncated to zero size (for example, when the table was truncated), then pgBackRest still unconditionally places such a zero-size file in the bundle, taking up space in it equal to the size of the headings, and additionally writes the original file size to the manifest.

In debug build an assertion was added, that does not allow zero-size files to be written to bundles, which leads to an error.

To solve the problem, this patch, when reading the next file, loads one buffer from the file to detect if it is zero-size. If so it marks the file as truncated and continues on to the next file.

The advantages of the solution are that, firstly, the assert will not fire on debug builds, and secondly, we will not place zero-size files in bundles, which exactly corresponds to the specification.

The patch adds the backupCopyResultTruncate value to the BackupCopyResult enumeration to use it to indicate the result when a non-zero size file is truncated to zero size during the backup process.
2023-12-14 14:21:06 -03:00
..
certificate SFTP support for repository storage. 2023-05-13 19:16:16 +03:00
code-count Add support for alternate compile-time page sizes. 2023-12-14 13:28:52 -03:00
data
lib/pgBackRestTest Output coverage report on test failure in CI. 2023-11-29 09:31:57 -03:00
src Skip files truncated during backup when bundling. 2023-12-14 14:21:06 -03:00
.gitignore Move coverage results to test/result. 2020-03-14 15:29:42 -04:00
ci.pl Build command and configuration reference in C. 2023-10-09 14:03:43 -04:00
container.yaml Remove support for PostgreSQL 9.3. 2023-11-09 12:59:12 -03:00
define.yaml Migrate backupFile() tests in command/backup module. 2023-11-24 17:07:49 -03:00
Dockerfile SFTP support for repository storage. 2023-05-13 19:16:16 +03:00
test.pl Output coverage report on test failure in CI. 2023-11-29 09:31:57 -03:00
uncrustify.cfg Check for stray execute permissions in test.pl --code-format. 2023-02-01 12:57:04 +07:00
Vagrantfile SFTP support for repository storage. 2023-05-13 19:16:16 +03:00