1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2025-03-17 21:18:00 +02:00

wal_bytes for ARCHIVE backups was calculated incorrectly

This commit is contained in:
Grigory Smolkin 2019-11-01 18:42:20 +03:00
parent 2d2da5010d
commit 0d028b79ec

View File

@ -798,9 +798,19 @@ do_backup(time_t start_time, bool no_validate,
/* compute size of wal files of this backup stored in the archive */
if (!current.stream)
{
current.wal_bytes = instance_config.xlog_seg_size *
(current.stop_lsn / instance_config.xlog_seg_size -
current.start_lsn / instance_config.xlog_seg_size + 1);
XLogSegNo start_segno;
XLogSegNo stop_segno;
GetXLogSegNo(current.start_lsn, start_segno, instance_config.xlog_seg_size);
GetXLogSegNo(current.stop_lsn, stop_segno, instance_config.xlog_seg_size);
current.wal_bytes = (stop_segno - start_segno) * instance_config.xlog_seg_size;
/*
* If start_lsn and stop_lsn are located in the same segment, then
* set wal_bytes to the size of 1 segment.
*/
if (current.wal_bytes <= 0)
current.wal_bytes = instance_config.xlog_seg_size;
}
/* Backup is done. Update backup status */