Skip to content

Commit 126c424

Browse files
committed
remove obsolete block of code, improve comments
1 parent 70d85d1 commit 126c424

File tree

3 files changed

+10
-28
lines changed

3 files changed

+10
-28
lines changed

configure.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ pgBackupConfigInit(pgBackupConfig *config)
8686
config->master_port = NULL;
8787
config->master_db = NULL;
8888
config->master_user = NULL;
89-
config->replica_timeout = INT_MIN; // INT_MIN means "undefined"
89+
config->replica_timeout = INT_MIN; /* INT_MIN means "undefined" */
9090

91-
config->log_level = INT_MIN; // INT_MIN means "undefined"
91+
config->log_level = INT_MIN; /* INT_MIN means "undefined" */
9292
config->log_filename = NULL;
9393
config->error_log_filename = NULL;
9494
config->log_directory = NULL;

data.c

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -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
*/
257260
bool
258261
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)
455458
write_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 */
462463
if (chmod(to_path, file->mode) == -1)
@@ -572,27 +573,8 @@ restore_data_file(const char *from_root,
572573
else
573574
memcpy(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
*/
597579
blknum = header.block;
598580
if (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 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.
625607
*/
626608
bool
627609
copy_file(const char *from_root, const char *to_root, pgFile *file)

util.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ base36enc(long unsigned int value)
2727
buffer[--offset] = base36[value % 36];
2828
} while (value /= 36);
2929

30-
return strdup(&buffer[offset]); // warning: this must be free-d by the user
30+
return strdup(&buffer[offset]); /* warning: this must be free-d by the user */
3131
}
3232

3333
long unsigned int

0 commit comments

Comments
 (0)