@@ -155,6 +155,7 @@ do_backup_instance(PGconn *backup_conn, PGNodeInfo *nodeInfo)
155
155
156
156
/* for fancy reporting */
157
157
time_t start_time , end_time ;
158
+ char pretty_bytes [20 ];
158
159
159
160
elog (LOG , "Database backup start" );
160
161
if (current .external_dir_str )
@@ -330,6 +331,20 @@ do_backup_instance(PGconn *backup_conn, PGNodeInfo *nodeInfo)
330
331
elog (ERROR , "PGDATA is almost empty. Either it was concurrently deleted or "
331
332
"pg_probackup do not possess sufficient permissions to list PGDATA content" );
332
333
334
+ /* Calculate pgdata_bytes */
335
+ for (i = 0 ; i < parray_num (backup_files_list ); i ++ )
336
+ {
337
+ pgFile * file = (pgFile * ) parray_get (backup_files_list , i );
338
+
339
+ if (file -> external_dir_num != 0 )
340
+ continue ;
341
+
342
+ current .pgdata_bytes += file -> size ;
343
+ }
344
+
345
+ pretty_size (current .pgdata_bytes , pretty_bytes , lengthof (pretty_bytes ));
346
+ elog (INFO , "PGDATA size: %s" , pretty_bytes );
347
+
333
348
/*
334
349
* Sort pathname ascending. It is necessary to create intermediate
335
350
* directories sequentially.
@@ -547,22 +562,6 @@ do_backup_instance(PGconn *backup_conn, PGNodeInfo *nodeInfo)
547
562
/* close ssh session in main thread */
548
563
fio_disconnect ();
549
564
550
- /* Calculate pgdata_bytes */
551
- for (i = 0 ; i < parray_num (backup_files_list ); i ++ )
552
- {
553
- pgFile * file = (pgFile * ) parray_get (backup_files_list , i );
554
-
555
- /* In case of FULL or DELTA backup we can trust read_size.
556
- * In case of PAGE or PTRACK we are forced to trust datafile size,
557
- * taken at the start of backup.
558
- */
559
- if (current .backup_mode == BACKUP_MODE_FULL ||
560
- current .backup_mode == BACKUP_MODE_DIFF_DELTA )
561
- current .pgdata_bytes += file -> read_size ;
562
- else
563
- current .pgdata_bytes += file -> size ;
564
- }
565
-
566
565
/* Add archived xlog files into the list of files of this backup */
567
566
if (stream_wal )
568
567
{
699
698
do_backup (time_t start_time , bool no_validate ,
700
699
pgSetBackupParams * set_backup_params )
701
700
{
702
- PGconn * backup_conn = NULL ;
703
- PGNodeInfo nodeInfo ;
704
- char pretty_data_bytes [20 ];
701
+ PGconn * backup_conn = NULL ;
702
+ PGNodeInfo nodeInfo ;
703
+ char pretty_bytes [20 ];
705
704
706
705
/* Initialize PGInfonode */
707
706
pgNodeInit (& nodeInfo );
@@ -836,10 +835,10 @@ do_backup(time_t start_time, bool no_validate,
836
835
837
836
/* Notify user about backup size */
838
837
if (current .stream )
839
- pretty_size (current .data_bytes + current .wal_bytes , pretty_data_bytes , lengthof (pretty_data_bytes ));
838
+ pretty_size (current .data_bytes + current .wal_bytes , pretty_bytes , lengthof (pretty_bytes ));
840
839
else
841
- pretty_size (current .data_bytes , pretty_data_bytes , lengthof (pretty_data_bytes ));
842
- elog (INFO , "Backup %s resident size: %s" , base36enc (current .start_time ), pretty_data_bytes );
840
+ pretty_size (current .data_bytes , pretty_bytes , lengthof (pretty_bytes ));
841
+ elog (INFO , "Backup %s resident size: %s" , base36enc (current .start_time ), pretty_bytes );
843
842
844
843
if (current .status == BACKUP_STATUS_OK ||
845
844
current .status == BACKUP_STATUS_DONE )
0 commit comments