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

Commit2f843a7

Browse files
committed
[Issue#227] Remove support of ptrack1.x, clean up redundant code in catchup
1 parent2afa159 commit2f843a7

File tree

3 files changed

+15
-91
lines changed

3 files changed

+15
-91
lines changed

‎src/catchup.c

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ do_catchup_instance(const char *source_pgdata, const char *dest_pgdata, PGconn *
9191
backup_mode==BACKUP_MODE_DIFF_DELTA))
9292
{
9393
dest_filelist=parray_new();
94-
dir_list_file(dest_filelist,dest_pgdata,
94+
dir_list_file(dest_filelist,dest_pgdata,
9595
true, true, false,backup_logs, true,0,FIO_LOCAL_HOST);
9696

9797
sync_lsn=get_min_recovery_point(dest_pgdata);
@@ -268,18 +268,10 @@ do_catchup_instance(const char *source_pgdata, const char *dest_pgdata, PGconn *
268268
arg->nodeInfo=nodeInfo;
269269
arg->from_root=source_pgdata;
270270
arg->to_root=dest_pgdata;
271-
/* TODO разобраться */
272-
//arg->external_prefix = external_prefix;
273-
//arg->external_dirs = external_dirs;
274271
arg->source_filelist=source_filelist;
275-
/* TODO !!!! change to target file_list */
276272
arg->dest_filelist=dest_filelist;
277273
arg->sync_lsn=sync_lsn;
278274
arg->backup_mode=backup_mode;
279-
arg->conn_arg.conn=NULL;
280-
arg->conn_arg.cancel_conn=NULL;
281-
/* TODO !!!! */
282-
arg->hdr_map=&(current.hdr_map);
283275
arg->thread_num=i+1;
284276
/* By default there are some error */
285277
arg->ret=1;
@@ -564,15 +556,15 @@ catchup_files(void *arg)
564556
/* Do actual work */
565557
if (file->is_datafile&& !file->is_cfs)
566558
{
567-
catchup_data_file(&(arguments->conn_arg),file,from_fullpath,to_fullpath,
559+
catchup_data_file(file,from_fullpath,to_fullpath,
568560
arguments->sync_lsn,
569561
arguments->backup_mode,
570562
NONE_COMPRESS,
571563
0,
572564
arguments->nodeInfo->checksum_version,
573565
arguments->nodeInfo->ptrack_version_num,
574566
arguments->nodeInfo->ptrack_schema,
575-
arguments->hdr_map,false);
567+
false);
576568
}
577569
else
578570
{

‎src/data.c

Lines changed: 8 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,7 @@ get_checksum_errormsg(Page page, char **errormsg, BlockNumber absolute_blkno)
276276
* return it to the caller
277277
*/
278278
staticint32
279-
prepare_page(ConnectionArgs*conn_arg,
280-
pgFile*file,XLogRecPtrprev_backup_start_lsn,
279+
prepare_page(pgFile*file,XLogRecPtrprev_backup_start_lsn,
281280
BlockNumberblknum,FILE*in,
282281
BackupModebackup_mode,
283282
Pagepage,boolstrict,
@@ -395,66 +394,6 @@ prepare_page(ConnectionArgs *conn_arg,
395394
returnPageIsOk;
396395
}
397396

398-
/*
399-
* Get page via ptrack interface from PostgreSQL shared buffer.
400-
* We do this only in the cases of PTRACK 1.x versions backup
401-
*/
402-
if (backup_mode==BACKUP_MODE_DIFF_PTRACK
403-
&& (ptrack_version_num >=15&&ptrack_version_num<20))
404-
{
405-
intrc=0;
406-
size_tpage_size=0;
407-
Pageptrack_page=NULL;
408-
ptrack_page= (Page)pg_ptrack_get_block(conn_arg,file->dbOid,file->tblspcOid,
409-
file->relOid,absolute_blknum,&page_size,
410-
ptrack_version_num,ptrack_schema);
411-
412-
if (ptrack_page==NULL)
413-
/* This block was truncated.*/
414-
returnPageIsTruncated;
415-
416-
if (page_size!=BLCKSZ)
417-
elog(ERROR,"File: \"%s\", block %u, expected block size %d, but read %zu",
418-
from_fullpath,blknum,BLCKSZ,page_size);
419-
420-
/*
421-
* We need to copy the page that was successfully
422-
* retrieved from ptrack into our output "page" parameter.
423-
*/
424-
memcpy(page,ptrack_page,BLCKSZ);
425-
pg_free(ptrack_page);
426-
427-
/*
428-
* UPD: It apprears that is possible to get zeroed page or page with invalid header
429-
* from shared buffer.
430-
* Note, that getting page with wrong checksumm from shared buffer is
431-
* acceptable.
432-
*/
433-
rc=validate_one_page(page,absolute_blknum,
434-
InvalidXLogRecPtr,page_st,
435-
checksum_version);
436-
437-
/* It is ok to get zeroed page */
438-
if (rc==PAGE_IS_ZEROED)
439-
returnPageIsOk;
440-
441-
/* Getting page with invalid header from shared buffers is unacceptable */
442-
if (rc==PAGE_HEADER_IS_INVALID)
443-
{
444-
char*errormsg=NULL;
445-
get_header_errormsg(page,&errormsg);
446-
elog(ERROR,"Corruption detected in file \"%s\", block %u: %s",
447-
from_fullpath,blknum,errormsg);
448-
}
449-
450-
/*
451-
* We must set checksum here, because it is outdated
452-
* in the block recieved from shared buffers.
453-
*/
454-
if (checksum_version)
455-
page_st->checksum= ((PageHeader)page)->pd_checksum=pg_checksum_page(page,absolute_blknum);
456-
}
457-
458397
/*
459398
* Skip page if page lsn is less than START_LSN of parent backup.
460399
* Nullified pages must be copied by DELTA backup, just to be safe.
@@ -714,12 +653,11 @@ backup_data_file(ConnectionArgs* conn_arg, pgFile *file,
714653
* backup with special header.
715654
*/
716655
void
717-
catchup_data_file(ConnectionArgs*conn_arg,pgFile*file,
718-
constchar*from_fullpath,constchar*to_fullpath,
656+
catchup_data_file(pgFile*file,constchar*from_fullpath,constchar*to_fullpath,
719657
XLogRecPtrprev_backup_start_lsn,BackupModebackup_mode,
720658
CompressAlgcalg,intclevel,uint32checksum_version,
721659
intptrack_version_num,constchar*ptrack_schema,
722-
HeaderMap*hdr_map,boolis_merge)
660+
boolis_merge)
723661
{
724662
intrc;
725663
booluse_pagemap;
@@ -796,7 +734,7 @@ catchup_data_file(ConnectionArgs* conn_arg, pgFile *file,
796734
else
797735
{
798736
/* TODO: stop handling errors internally */
799-
rc=copy_pages(conn_arg,to_fullpath,from_fullpath,file,
737+
rc=copy_pages(to_fullpath,from_fullpath,file,
800738
/* send prev backup START_LSN */
801739
backup_mode==BACKUP_MODE_DIFF_DELTA&&
802740
file->exists_in_prev ?prev_backup_start_lsn :InvalidXLogRecPtr,
@@ -1742,7 +1680,7 @@ check_data_file(ConnectionArgs *arguments, pgFile *file,
17421680
for (blknum=0;blknum<nblocks;blknum++)
17431681
{
17441682
PageStatepage_st;
1745-
page_state=prepare_page(NULL,file,InvalidXLogRecPtr,
1683+
page_state=prepare_page(file,InvalidXLogRecPtr,
17461684
blknum,in,BACKUP_MODE_FULL,
17471685
curr_page, false,checksum_version,
17481686
0,NULL,from_fullpath,&page_st);
@@ -2228,7 +2166,7 @@ send_pages(ConnectionArgs* conn_arg, const char *to_fullpath, const char *from_f
22282166
while (blknum<file->n_blocks)
22292167
{
22302168
PageStatepage_st;
2231-
intrc=prepare_page(conn_arg,file,prev_backup_start_lsn,
2169+
intrc=prepare_page(file,prev_backup_start_lsn,
22322170
blknum,in,backup_mode,curr_page,
22332171
true,checksum_version,
22342172
ptrack_version_num,ptrack_schema,
@@ -2303,7 +2241,7 @@ send_pages(ConnectionArgs* conn_arg, const char *to_fullpath, const char *from_f
23032241

23042242
/* copy local file (взята из send_pages, но используется простое копирование странички, без добавления заголовков и компрессии) */
23052243
int
2306-
copy_pages(ConnectionArgs*conn_arg,constchar*to_fullpath,constchar*from_fullpath,
2244+
copy_pages(constchar*to_fullpath,constchar*from_fullpath,
23072245
pgFile*file,XLogRecPtrprev_backup_start_lsn,
23082246
uint32checksum_version,booluse_pagemap,
23092247
BackupModebackup_mode,intptrack_version_num,constchar*ptrack_schema)
@@ -2358,7 +2296,7 @@ copy_pages(ConnectionArgs* conn_arg, const char *to_fullpath, const char *from_f
23582296
while (blknum<file->n_blocks)
23592297
{
23602298
PageStatepage_st;
2361-
intrc=prepare_page(conn_arg,file,prev_backup_start_lsn,
2299+
intrc=prepare_page(file,prev_backup_start_lsn,
23622300
blknum,in,backup_mode,curr_page,
23632301
true,checksum_version,
23642302
ptrack_version_num,ptrack_schema,

‎src/pg_probackup.h

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -601,18 +601,13 @@ typedef struct
601601

602602
constchar*from_root;
603603
constchar*to_root;
604-
constchar*external_prefix;
605604

606605
parray*source_filelist;
607606
parray*dest_filelist;
608-
/* TODO разобраться */
609-
//parray *external_dirs;
607+
610608
XLogRecPtrsync_lsn;
611609
BackupModebackup_mode;
612-
613-
ConnectionArgsconn_arg;
614610
intthread_num;
615-
HeaderMap*hdr_map;
616611

617612
/*
618613
* Return value from the thread.
@@ -1093,12 +1088,11 @@ extern void backup_data_file(ConnectionArgs* conn_arg, pgFile *file,
10931088
CompressAlgcalg,intclevel,uint32checksum_version,
10941089
intptrack_version_num,constchar*ptrack_schema,
10951090
HeaderMap*hdr_map,boolmissing_ok);
1096-
externvoidcatchup_data_file(ConnectionArgs*conn_arg,pgFile*file,
1097-
constchar*from_fullpath,constchar*to_fullpath,
1091+
externvoidcatchup_data_file(pgFile*file,constchar*from_fullpath,constchar*to_fullpath,
10981092
XLogRecPtrprev_backup_start_lsn,BackupModebackup_mode,
10991093
CompressAlgcalg,intclevel,uint32checksum_version,
11001094
intptrack_version_num,constchar*ptrack_schema,
1101-
HeaderMap*hdr_map,boolmissing_ok);
1095+
boolmissing_ok);
11021096
externvoidbackup_non_data_file(pgFile*file,pgFile*prev_file,
11031097
constchar*from_fullpath,constchar*to_fullpath,
11041098
BackupModebackup_mode,time_tparent_backup_time,
@@ -1226,7 +1220,7 @@ extern int send_pages(ConnectionArgs* conn_arg, const char *to_fullpath, const c
12261220
pgFile*file,XLogRecPtrprev_backup_start_lsn,CompressAlgcalg,intclevel,
12271221
uint32checksum_version,booluse_pagemap,BackupPageHeader2**headers,
12281222
BackupModebackup_mode,intptrack_version_num,constchar*ptrack_schema);
1229-
externintcopy_pages(ConnectionArgs*conn_arg,constchar*to_fullpath,constchar*from_fullpath,
1223+
externintcopy_pages(constchar*to_fullpath,constchar*from_fullpath,
12301224
pgFile*file,XLogRecPtrprev_backup_start_lsn,
12311225
uint32checksum_version,booluse_pagemap,
12321226
BackupModebackup_mode,intptrack_version_num,constchar*ptrack_schema);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp