@@ -253,6 +253,9 @@ backup_data_page(pgFile *file, XLogRecPtr prev_backup_start_lsn,
253
253
* Backup data file in the from_root directory to the to_root directory with
254
254
* same relative path. If prev_backup_start_lsn is not NULL, only pages with
255
255
* 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.
256
259
*/
257
260
bool
258
261
backup_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)
455
458
write_size += read_len ;
456
459
}
457
460
458
- // elog(LOG, "restore_file_partly(). %s write_size %lu, file->write_size %lu",
459
- // file->path, write_size, file->write_size);
460
461
461
462
/* update file permission */
462
463
if (chmod (to_path , file -> mode ) == -1 )
@@ -572,27 +573,8 @@ restore_data_file(const char *from_root,
572
573
else
573
574
memcpy (page .data , compressed_page .data , BLCKSZ );
574
575
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
-
593
576
/*
594
- * Seek and write the restored page. Backup might have holes in
595
- * differential backups.
577
+ * Seek and write the restored page.
596
578
*/
597
579
blknum = header .block ;
598
580
if (fseek (out , blknum * BLCKSZ , SEEK_SET ) < 0 )
@@ -619,9 +601,9 @@ restore_data_file(const char *from_root,
619
601
}
620
602
621
603
/*
622
- * Add check that file is not bigger than RELSEG_SIZE .
623
- * WARNING cfs_compressed file can be exceed this limit.
624
- * Add compression .
604
+ * Copy file to backup .
605
+ * We do not apply compression to these files, because
606
+ * it is either small control file or already compressed cfs file .
625
607
*/
626
608
bool
627
609
copy_file (const char * from_root , const char * to_root , pgFile * file )
0 commit comments