@@ -253,6 +253,9 @@ backup_data_page(pgFile *file, XLogRecPtr prev_backup_start_lsn,
253253 * Backup data file in the from_root directory to the to_root directory with
254254 * same relative path. If prev_backup_start_lsn is not NULL, only pages with
255255 * higher lsn will be copied.
256+ * Not just copy file, but read it block by block (use bitmap in case of
257+ * incremental backup), validate checksum, optionally compress and write to
258+ * backup with special header.
256259 */
257260bool
258261backup_data_file (const char * from_root ,const char * to_root ,
@@ -455,8 +458,6 @@ restore_file_partly(const char *from_root,const char *to_root, pgFile *file)
455458write_size += read_len ;
456459}
457460
458- // elog(LOG, "restore_file_partly(). %s write_size %lu, file->write_size %lu",
459- // file->path, write_size, file->write_size);
460461
461462/* update file permission */
462463if (chmod (to_path ,file -> mode )== -1 )
@@ -572,27 +573,8 @@ restore_data_file(const char *from_root,
572573else
573574memcpy (page .data ,compressed_page .data ,BLCKSZ );
574575
575- /* update checksum because we are not save whole */
576- if (backup -> checksum_version )
577- {
578- bool is_zero_page = false;
579-
580- if (page .page_data .pd_upper == 0 )
581- {
582- int i ;
583- for (i = 0 ;i < BLCKSZ && page .data [i ]== 0 ;i ++ );
584- if (i == BLCKSZ )
585- is_zero_page = true;
586- }
587-
588- /* skip calc checksum if zero page */
589- if (!is_zero_page )
590- ((PageHeader )page .data )-> pd_checksum = pg_checksum_page (page .data ,file -> segno * RELSEG_SIZE + header .block );
591- }
592-
593576/*
594- * Seek and write the restored page. Backup might have holes in
595- * differential backups.
577+ * Seek and write the restored page.
596578 */
597579blknum = header .block ;
598580if (fseek (out ,blknum * BLCKSZ ,SEEK_SET )< 0 )
@@ -619,9 +601,9 @@ restore_data_file(const char *from_root,
619601}
620602
621603/*
622- *Add check that fileis not bigger than RELSEG_SIZE .
623- *WARNING cfs_compressed file can be exceed this limit.
624- *Add compression .
604+ *Copy fileto backup .
605+ *We do not apply compression to these files, because
606+ *it is either small control file or already compressed cfs file .
625607 */
626608bool
627609copy_file (const char * from_root ,const char * to_root ,pgFile * file )