@@ -542,7 +542,7 @@ backup_data_file(backup_files_arg* arguments,
542542 BlockNumber blknum = 0 ;
543543 BlockNumber nblocks = 0 ;
544544 BlockNumber n_blocks_skipped = 0 ;
545- BlockNumber n_blocks_read = 0 ;
545+ BlockNumber n_blocks_read = 0 ; /* number of blocks actually readed */
546546 int page_state ;
547547 char curr_page [BLCKSZ ];
548548
@@ -570,7 +570,7 @@ backup_data_file(backup_files_arg* arguments,
570570 file -> uncompressed_size = 0 ;
571571 INIT_FILE_CRC32 (true, file -> crc );
572572
573- /* open backup mode file for read */
573+ /* open source mode file for read */
574574 in = fio_fopen (file -> path , PG_BINARY_R , FIO_DB_HOST );
575575 if (in == NULL )
576576 {
@@ -639,6 +639,8 @@ backup_data_file(backup_files_arg* arguments,
639639 if (rc < 0 )
640640 elog (ERROR , "Failed to read file \"%s\": %s" ,
641641 file -> path , rc == PAGE_CHECKSUM_MISMATCH ? "data file checksum mismatch" : strerror (- rc ));
642+
643+ /* TODO: check that fio_send_pages ain`t bullshitting about number of readed blocks */
642644 n_blocks_read = rc ;
643645
644646 file -> read_size = n_blocks_read * BLCKSZ ;
@@ -714,6 +716,9 @@ backup_data_file(backup_files_arg* arguments,
714716 /*
715717 * If we have pagemap then file in the backup can't be a zero size.
716718 * Otherwise, we will clear the last file.
719+ *
720+ * TODO: maybe we should just check write_size to be >= 0.
721+ * Or better yeat, open file only there is something to write.
717722 */
718723 if (n_blocks_read != 0 && n_blocks_read == n_blocks_skipped )
719724 {
0 commit comments