Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit109af56

Browse files
committed
refactoring. remove unneeded calc_file_checksum() function
1 parent14418a2 commit109af56

File tree

3 files changed

+16
-20
lines changed

3 files changed

+16
-20
lines changed

‎src/backup.c

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,11 @@ do_backup_instance(void)
537537
{
538538
pgFile*file= (pgFile*)parray_get(xlog_files_list,i);
539539
if (S_ISREG(file->mode))
540-
calc_file_checksum(file,FIO_BACKUP_HOST);
540+
{
541+
file->crc=pgFileGetCRC(file->path, true, false,
542+
&file->read_size,FIO_BACKUP_HOST);
543+
file->write_size=file->read_size;
544+
}
541545
/* Remove file path root prefix*/
542546
if (strstr(file->path,database_path)==file->path)
543547
{
@@ -2022,7 +2026,9 @@ pg_stop_backup(pgBackup *backup)
20222026
if (backup_files_list)
20232027
{
20242028
file=pgFileNew(backup_label, true,0,FIO_BACKUP_HOST);
2025-
calc_file_checksum(file,FIO_BACKUP_HOST);
2029+
file->crc=pgFileGetCRC(file->path, true, false,
2030+
&file->read_size,FIO_BACKUP_HOST);
2031+
file->write_size=file->read_size;
20262032
free(file->path);
20272033
file->path=strdup(PG_BACKUP_LABEL_FILE);
20282034
parray_append(backup_files_list,file);
@@ -2066,7 +2072,11 @@ pg_stop_backup(pgBackup *backup)
20662072
{
20672073
file=pgFileNew(tablespace_map, true,0,FIO_BACKUP_HOST);
20682074
if (S_ISREG(file->mode))
2069-
calc_file_checksum(file,FIO_BACKUP_HOST);
2075+
{
2076+
file->crc=pgFileGetCRC(file->path, true, false,
2077+
&file->read_size,FIO_BACKUP_HOST);
2078+
file->write_size=file->read_size;
2079+
}
20702080
free(file->path);
20712081
file->path=strdup(PG_TABLESPACE_MAP_FILE);
20722082
parray_append(backup_files_list,file);
@@ -2475,7 +2485,9 @@ backup_files(void *arg)
24752485
if (prev_file&&file->exists_in_prev&&
24762486
buf.st_mtime<current.parent_backup)
24772487
{
2478-
calc_file_checksum(file,FIO_DB_HOST);
2488+
file->crc=pgFileGetCRC(file->path, true, false,
2489+
&file->read_size,FIO_DB_HOST);
2490+
file->write_size=file->read_size;
24792491
/* ...and checksum is the same... */
24802492
if (EQ_TRADITIONAL_CRC32(file->crc, (*prev_file)->crc))
24812493
skip= true;/* ...skip copying file. */

‎src/data.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,20 +1068,6 @@ copy_file(const char *from_root, fio_location from_location,
10681068
return true;
10691069
}
10701070

1071-
/*
1072-
* Calculate checksum of various files which are not copied from PGDATA,
1073-
* but created in process of backup, such as stream XLOG files,
1074-
* PG_TABLESPACE_MAP_FILE and PG_BACKUP_LABEL_FILE.
1075-
*/
1076-
void
1077-
calc_file_checksum(pgFile*file,fio_locationlocation)
1078-
{
1079-
Assert(S_ISREG(file->mode));
1080-
1081-
file->crc=pgFileGetCRC(file->path, true, false,&file->read_size,location);
1082-
file->write_size=file->read_size;
1083-
}
1084-
10851071
/*
10861072
* Validate given page.
10871073
*

‎src/pg_probackup.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -625,8 +625,6 @@ extern void restore_data_file(const char *to_path,
625625
externboolcopy_file(constchar*from_root,fio_locationfrom_location,constchar*to_root,fio_locationto_location,pgFile*file);
626626
externvoidmove_file(constchar*from_root,constchar*to_root,pgFile*file);
627627

628-
externvoidcalc_file_checksum(pgFile*file,fio_locationlocation);
629-
630628
externboolcheck_file_pages(pgFile*file,XLogRecPtrstop_lsn,
631629
uint32checksum_version,uint32backup_version);
632630
/* parsexlog.c */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp