Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9edb2e3

Browse files
committed
minor improvement: for STREAM backups include wal_bytes into message about resident data size
1 parent 59c341a commit 9edb2e3

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/backup.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -815,8 +815,11 @@ do_backup(time_t start_time, bool no_validate,
815815
pgBackupValidate(&current, NULL);
816816

817817
/* Notify user about backup size */
818-
pretty_size(current.data_bytes, pretty_data_bytes, lengthof(pretty_data_bytes));
819-
elog(INFO, "Backup %s real size: %s", base36enc(current.start_time), pretty_data_bytes);
818+
if (current.stream)
819+
pretty_size(current.data_bytes + current.wal_bytes, pretty_data_bytes, lengthof(pretty_data_bytes));
820+
else
821+
pretty_size(current.data_bytes, pretty_data_bytes, lengthof(pretty_data_bytes));
822+
elog(INFO, "Backup %s resident size: %s", base36enc(current.start_time), pretty_data_bytes);
820823

821824
if (current.status == BACKUP_STATUS_OK ||
822825
current.status == BACKUP_STATUS_DONE)
@@ -1828,6 +1831,9 @@ pg_stop_backup(pgBackup *backup, PGconn *pg_startbackup_conn,
18281831

18291832
backup_in_progress = false;
18301833

1834+
// char *target_lsn = "2/F578A000";
1835+
// XLogDataFromLSN(target_lsn, &lsn_hi, &lsn_lo);
1836+
18311837
/* Extract timeline and LSN from results of pg_stop_backup() */
18321838
XLogDataFromLSN(PQgetvalue(res, 0, 2), &lsn_hi, &lsn_lo);
18331839
/* Calculate LSN */

0 commit comments

Comments
 (0)