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

Commit72d3d52

Browse files
authored
Merge pull request#665 from postgrespro/github-sync
GitHub sync
2 parents283daff +4c84105 commit72d3d52

File tree

7 files changed

+150
-63
lines changed

7 files changed

+150
-63
lines changed

‎src/backup.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -505,12 +505,12 @@ do_backup_pg(InstanceState *instanceState, PGconn *backup_conn,
505505
/* copy pg_control at very end */
506506
if (backup_isok)
507507
{
508+
charfrom_fullpath[MAXPGPATH];
509+
charto_fullpath[MAXPGPATH];
508510

509511
elog(progress ?INFO :LOG,"Progress: Backup file \"%s\"",
510512
src_pg_control_file->rel_path);
511513

512-
charfrom_fullpath[MAXPGPATH];
513-
charto_fullpath[MAXPGPATH];
514514
join_path_components(from_fullpath,instance_config.pgdata,src_pg_control_file->rel_path);
515515
join_path_components(to_fullpath,current.database_dir,src_pg_control_file->rel_path);
516516

‎src/catalog.c‎

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1755,27 +1755,27 @@ catalog_get_timelines(InstanceState *instanceState, InstanceConfig *instance)
17551755

17561756
for (i=0;i<parray_num(timelineinfos);i++)
17571757
{
1758-
timelineInfo*tlinfo=parray_get(timelineinfos,i);
1758+
timelineInfo*tlInfo=parray_get(timelineinfos,i);
17591759
for (j=0;j<parray_num(backups);j++)
17601760
{
17611761
pgBackup*backup=parray_get(backups,j);
1762-
if (tlinfo->tli==backup->tli)
1762+
if (tlInfo->tli==backup->tli)
17631763
{
1764-
if (tlinfo->backups==NULL)
1765-
tlinfo->backups=parray_new();
1764+
if (tlInfo->backups==NULL)
1765+
tlInfo->backups=parray_new();
17661766

1767-
parray_append(tlinfo->backups,backup);
1767+
parray_append(tlInfo->backups,backup);
17681768
}
17691769
}
17701770
}
17711771

17721772
/* determine oldest backup and closest backup for every timeline */
17731773
for (i=0;i<parray_num(timelineinfos);i++)
17741774
{
1775-
timelineInfo*tlinfo=parray_get(timelineinfos,i);
1775+
timelineInfo*tlInfo=parray_get(timelineinfos,i);
17761776

1777-
tlinfo->oldest_backup=get_oldest_backup(tlinfo);
1778-
tlinfo->closest_backup=get_closest_backup(tlinfo);
1777+
tlInfo->oldest_backup=get_oldest_backup(tlInfo);
1778+
tlInfo->closest_backup=get_closest_backup(tlInfo);
17791779
}
17801780

17811781
/* determine which WAL segments must be kept because of wal retention */
@@ -1845,18 +1845,18 @@ catalog_get_timelines(InstanceState *instanceState, InstanceConfig *instance)
18451845
for (i=0;i<parray_num(timelineinfos);i++)
18461846
{
18471847
intcount=0;
1848-
timelineInfo*tlinfo=parray_get(timelineinfos,i);
1848+
timelineInfo*tlInfo=parray_get(timelineinfos,i);
18491849

18501850
/*
18511851
* Iterate backward on backups belonging to this timeline to find
18521852
* anchor_backup. NOTE Here we rely on the fact that backups list
18531853
* is ordered by start_lsn DESC.
18541854
*/
1855-
if (tlinfo->backups)
1855+
if (tlInfo->backups)
18561856
{
1857-
for (j=0;j<parray_num(tlinfo->backups);j++)
1857+
for (j=0;j<parray_num(tlInfo->backups);j++)
18581858
{
1859-
pgBackup*backup=parray_get(tlinfo->backups,j);
1859+
pgBackup*backup=parray_get(tlInfo->backups,j);
18601860

18611861
/* sanity */
18621862
if (XLogRecPtrIsInvalid(backup->start_lsn)||
@@ -1886,12 +1886,12 @@ catalog_get_timelines(InstanceState *instanceState, InstanceConfig *instance)
18861886
if (count==instance->wal_depth)
18871887
{
18881888
elog(LOG,"On timeline %i WAL is protected from purge at %X/%X",
1889-
tlinfo->tli,
1889+
tlInfo->tli,
18901890
(uint32) (backup->start_lsn >>32),
18911891
(uint32) (backup->start_lsn));
18921892

1893-
tlinfo->anchor_lsn=backup->start_lsn;
1894-
tlinfo->anchor_tli=backup->tli;
1893+
tlInfo->anchor_lsn=backup->start_lsn;
1894+
tlInfo->anchor_tli=backup->tli;
18951895
break;
18961896
}
18971897
}
@@ -1916,7 +1916,7 @@ catalog_get_timelines(InstanceState *instanceState, InstanceConfig *instance)
19161916
* If closest_backup is not available, then general WAL purge rules
19171917
* are applied.
19181918
*/
1919-
if (XLogRecPtrIsInvalid(tlinfo->anchor_lsn))
1919+
if (XLogRecPtrIsInvalid(tlInfo->anchor_lsn))
19201920
{
19211921
/*
19221922
* Failed to find anchor_lsn in our own timeline.
@@ -1942,7 +1942,7 @@ catalog_get_timelines(InstanceState *instanceState, InstanceConfig *instance)
19421942
xlogInterval*interval=NULL;
19431943
TimeLineIDtli=0;
19441944
/* check if tli has closest_backup */
1945-
if (!tlinfo->closest_backup)
1945+
if (!tlInfo->closest_backup)
19461946
/* timeline has no closest_backup, wal retention cannot be
19471947
* applied to this timeline.
19481948
* Timeline will be purged up to oldest_backup if any or
@@ -1952,47 +1952,47 @@ catalog_get_timelines(InstanceState *instanceState, InstanceConfig *instance)
19521952
continue;
19531953

19541954
/* sanity for closest_backup */
1955-
if (XLogRecPtrIsInvalid(tlinfo->closest_backup->start_lsn)||
1956-
tlinfo->closest_backup->tli <=0)
1955+
if (XLogRecPtrIsInvalid(tlInfo->closest_backup->start_lsn)||
1956+
tlInfo->closest_backup->tli <=0)
19571957
continue;
19581958

19591959
/*
19601960
* Set anchor_lsn and anchor_tli to protect whole timeline from purge
19611961
* In the example above: tli3.
19621962
*/
1963-
tlinfo->anchor_lsn=tlinfo->closest_backup->start_lsn;
1964-
tlinfo->anchor_tli=tlinfo->closest_backup->tli;
1963+
tlInfo->anchor_lsn=tlInfo->closest_backup->start_lsn;
1964+
tlInfo->anchor_tli=tlInfo->closest_backup->tli;
19651965

19661966
/* closest backup may be located not in parent timeline */
1967-
closest_backup=tlinfo->closest_backup;
1967+
closest_backup=tlInfo->closest_backup;
19681968

1969-
tli=tlinfo->tli;
1969+
tli=tlInfo->tli;
19701970

19711971
/*
19721972
* Iterate over parent timeline chain and
19731973
* look for timeline where closest_backup belong
19741974
*/
1975-
while (tlinfo->parent_link)
1975+
while (tlInfo->parent_link)
19761976
{
19771977
/* In case of intermediate timeline save to keep_segments
19781978
* begin_segno and switchpoint segment.
19791979
* In case of final timelines save to keep_segments
19801980
* closest_backup start_lsn segment and switchpoint segment.
19811981
*/
1982-
XLogRecPtrswitchpoint=tlinfo->switchpoint;
1982+
XLogRecPtrswitchpoint=tlInfo->switchpoint;
19831983

1984-
tlinfo=tlinfo->parent_link;
1984+
tlInfo=tlInfo->parent_link;
19851985

1986-
if (tlinfo->keep_segments==NULL)
1987-
tlinfo->keep_segments=parray_new();
1986+
if (tlInfo->keep_segments==NULL)
1987+
tlInfo->keep_segments=parray_new();
19881988

19891989
/* in any case, switchpoint segment must be added to interval */
19901990
interval=palloc(sizeof(xlogInterval));
19911991
GetXLogSegNo(switchpoint,interval->end_segno,instance->xlog_seg_size);
19921992

19931993
/* Save [S1`, S2] to keep_segments */
1994-
if (tlinfo->tli!=closest_backup->tli)
1995-
interval->begin_segno=tlinfo->begin_segno;
1994+
if (tlInfo->tli!=closest_backup->tli)
1995+
interval->begin_segno=tlInfo->begin_segno;
19961996
/* Save [B1, S1] to keep_segments */
19971997
else
19981998
GetXLogSegNo(closest_backup->start_lsn,interval->begin_segno,instance->xlog_seg_size);
@@ -2002,27 +2002,27 @@ catalog_get_timelines(InstanceState *instanceState, InstanceConfig *instance)
20022002
* covered by other larger interval.
20032003
*/
20042004

2005-
GetXLogFileName(begin_segno_str,tlinfo->tli,interval->begin_segno,instance->xlog_seg_size);
2006-
GetXLogFileName(end_segno_str,tlinfo->tli,interval->end_segno,instance->xlog_seg_size);
2005+
GetXLogFileName(begin_segno_str,tlInfo->tli,interval->begin_segno,instance->xlog_seg_size);
2006+
GetXLogFileName(end_segno_str,tlInfo->tli,interval->end_segno,instance->xlog_seg_size);
20072007

20082008
elog(LOG,"Timeline %i to stay reachable from timeline %i "
20092009
"protect from purge WAL interval between "
20102010
"%s and %s on timeline %i",
20112011
tli,closest_backup->tli,begin_segno_str,
2012-
end_segno_str,tlinfo->tli);
2012+
end_segno_str,tlInfo->tli);
20132013

2014-
parray_append(tlinfo->keep_segments,interval);
2014+
parray_append(tlInfo->keep_segments,interval);
20152015
continue;
20162016
}
20172017
continue;
20182018
}
20192019

20202020
/* Iterate over backups left */
2021-
for (j=count;j<parray_num(tlinfo->backups);j++)
2021+
for (j=count;j<parray_num(tlInfo->backups);j++)
20222022
{
20232023
XLogSegNosegno=0;
20242024
xlogInterval*interval=NULL;
2025-
pgBackup*backup=parray_get(tlinfo->backups,j);
2025+
pgBackup*backup=parray_get(tlInfo->backups,j);
20262026

20272027
/*
20282028
* We must calculate keep_segments intervals for ARCHIVE backups
@@ -2039,7 +2039,7 @@ catalog_get_timelines(InstanceState *instanceState, InstanceConfig *instance)
20392039
continue;
20402040

20412041
/* no point in clogging keep_segments by backups protected by anchor_lsn */
2042-
if (backup->start_lsn >=tlinfo->anchor_lsn)
2042+
if (backup->start_lsn >=tlInfo->anchor_lsn)
20432043
continue;
20442044

20452045
/* append interval to keep_segments */
@@ -2057,19 +2057,19 @@ catalog_get_timelines(InstanceState *instanceState, InstanceConfig *instance)
20572057
else
20582058
interval->end_segno=segno;
20592059

2060-
GetXLogFileName(begin_segno_str,tlinfo->tli,interval->begin_segno,instance->xlog_seg_size);
2061-
GetXLogFileName(end_segno_str,tlinfo->tli,interval->end_segno,instance->xlog_seg_size);
2060+
GetXLogFileName(begin_segno_str,tlInfo->tli,interval->begin_segno,instance->xlog_seg_size);
2061+
GetXLogFileName(end_segno_str,tlInfo->tli,interval->end_segno,instance->xlog_seg_size);
20622062

20632063
elog(LOG,"Archive backup %s to stay consistent "
20642064
"protect from purge WAL interval "
20652065
"between %s and %s on timeline %i",
20662066
backup_id_of(backup),
20672067
begin_segno_str,end_segno_str,backup->tli);
20682068

2069-
if (tlinfo->keep_segments==NULL)
2070-
tlinfo->keep_segments=parray_new();
2069+
if (tlInfo->keep_segments==NULL)
2070+
tlInfo->keep_segments=parray_new();
20712071

2072-
parray_append(tlinfo->keep_segments,interval);
2072+
parray_append(tlInfo->keep_segments,interval);
20732073
}
20742074
}
20752075

@@ -2081,27 +2081,27 @@ catalog_get_timelines(InstanceState *instanceState, InstanceConfig *instance)
20812081
for (i=0;i<parray_num(timelineinfos);i++)
20822082
{
20832083
XLogSegNoanchor_segno=0;
2084-
timelineInfo*tlinfo=parray_get(timelineinfos,i);
2084+
timelineInfo*tlInfo=parray_get(timelineinfos,i);
20852085

20862086
/*
20872087
* At this point invalid anchor_lsn can be only in one case:
20882088
* timeline is going to be purged by regular WAL purge rules.
20892089
*/
2090-
if (XLogRecPtrIsInvalid(tlinfo->anchor_lsn))
2090+
if (XLogRecPtrIsInvalid(tlInfo->anchor_lsn))
20912091
continue;
20922092

20932093
/*
20942094
* anchor_lsn is located in another timeline, it means that the timeline
20952095
* will be protected from purge entirely.
20962096
*/
2097-
if (tlinfo->anchor_tli>0&&tlinfo->anchor_tli!=tlinfo->tli)
2097+
if (tlInfo->anchor_tli>0&&tlInfo->anchor_tli!=tlInfo->tli)
20982098
continue;
20992099

2100-
GetXLogSegNo(tlinfo->anchor_lsn,anchor_segno,instance->xlog_seg_size);
2100+
GetXLogSegNo(tlInfo->anchor_lsn,anchor_segno,instance->xlog_seg_size);
21012101

2102-
for (j=0;j<parray_num(tlinfo->xlog_filelist);j++)
2102+
for (j=0;j<parray_num(tlInfo->xlog_filelist);j++)
21032103
{
2104-
xlogFile*wal_file= (xlogFile*)parray_get(tlinfo->xlog_filelist,j);
2104+
xlogFile*wal_file= (xlogFile*)parray_get(tlInfo->xlog_filelist,j);
21052105

21062106
if (wal_file->segno >=anchor_segno)
21072107
{
@@ -2110,13 +2110,13 @@ catalog_get_timelines(InstanceState *instanceState, InstanceConfig *instance)
21102110
}
21112111

21122112
/* no keep segments */
2113-
if (!tlinfo->keep_segments)
2113+
if (!tlInfo->keep_segments)
21142114
continue;
21152115

21162116
/* Protect segments belonging to one of the keep invervals */
2117-
for (k=0;k<parray_num(tlinfo->keep_segments);k++)
2117+
for (k=0;k<parray_num(tlInfo->keep_segments);k++)
21182118
{
2119-
xlogInterval*keep_segments= (xlogInterval*)parray_get(tlinfo->keep_segments,k);
2119+
xlogInterval*keep_segments= (xlogInterval*)parray_get(tlInfo->keep_segments,k);
21202120

21212121
if ((wal_file->segno >=keep_segments->begin_segno)&&
21222122
wal_file->segno <=keep_segments->end_segno)

‎src/pg_probackup.h‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,8 @@ typedef struct InstanceConfig
431431
externConfigOptioninstance_options[];
432432
externInstanceConfiginstance_config;
433433
externtime_tcurrent_time;
434+
externboolno_validate;
435+
externIncrRestoreModeincremental_mode;
434436

435437
typedefstructPGNodeInfo
436438
{
@@ -805,9 +807,12 @@ extern pid_t my_pid;
805807
extern __threadintmy_thread_num;
806808
externintnum_threads;
807809
externboolstream_wal;
810+
externboolno_color;
808811
externboolshow_color;
809812
externboolprogress;
813+
externboolno_sync;
810814
externboolis_archive_cmd;/* true for archive-{get,push} */
815+
externtime_tstart_time;
811816
/* In pre-10 'replication_slot' is defined in receivelog.h */
812817
externchar*replication_slot;
813818
#ifPG_VERSION_NUM >=100000
@@ -816,6 +821,7 @@ extern bool temp_slot;
816821
externboolperm_slot;
817822

818823
/* backup options */
824+
externboolbackup_logs;
819825
externboolsmooth_checkpoint;
820826

821827
/* remote probackup options */
@@ -827,8 +833,15 @@ extern bool exclusive_backup;
827833
externbooldelete_wal;
828834
externbooldelete_expired;
829835
externboolmerge_expired;
836+
externboolforce;
830837
externbooldry_run;
831838

839+
/* archive push options */
840+
externintbatch_size;
841+
842+
/* archive get options */
843+
externboolno_validate_wal;
844+
832845
/* ===== instanceState ===== */
833846

834847
typedefstructInstanceState
@@ -858,11 +871,18 @@ typedef struct InstanceState
858871

859872
/* show options */
860873
externShowFormatshow_format;
874+
externboolshow_archive;
875+
876+
/* set backup options */
877+
externint64ttl;
861878

862879
/* checkdb options */
880+
externboolneed_amcheck;
863881
externboolheapallindexed;
864882
externboolcheckunique;
883+
externboolamcheck_parent;
865884
externboolskip_block_validation;
885+
externboolskip_external_dirs;
866886

867887
/* current settings */
868888
externpgBackupcurrent;

‎src/stream.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ parse_tli_history_buffer(char *history, TimeLineID tli)
592592
if (curLineLen>0)
593593
{
594594
char*ptr;
595-
TimeLineIDtli;
595+
TimeLineIDcurrTLI;
596596
uint32switchpoint_hi;
597597
uint32switchpoint_lo;
598598
intnfields;
@@ -605,7 +605,7 @@ parse_tli_history_buffer(char *history, TimeLineID tli)
605605
if (*ptr=='\0'||*ptr=='#')
606606
continue;
607607

608-
nfields=sscanf(tempStr,"%u\t%X/%X",&tli,&switchpoint_hi,&switchpoint_lo);
608+
nfields=sscanf(tempStr,"%u\t%X/%X",&currTLI,&switchpoint_hi,&switchpoint_lo);
609609

610610
if (nfields<1)
611611
{
@@ -615,11 +615,11 @@ parse_tli_history_buffer(char *history, TimeLineID tli)
615615
if (nfields!=3)
616616
elog(ERROR,"Syntax error in timeline history: \"%s\". Expected a transaction log switchpoint location.",tempStr);
617617

618-
if (last_timeline&&tli <=last_timeline->tli)
618+
if (last_timeline&&currTLI <=last_timeline->tli)
619619
elog(ERROR,"Timeline IDs must be in increasing sequence: \"%s\"",tempStr);
620620

621621
entry=pgut_new(TimeLineHistoryEntry);
622-
entry->tli=tli;
622+
entry->tli=currTLI;
623623
entry->end= ((uint64)switchpoint_hi <<32) |switchpoint_lo;
624624

625625
last_timeline=entry;
@@ -628,7 +628,7 @@ parse_tli_history_buffer(char *history, TimeLineID tli)
628628
result=parray_new();
629629
parray_append(result,entry);
630630
elog(VERBOSE,"parse_tli_history_buffer() found entry: tli = %X, end = %X/%X",
631-
tli,switchpoint_hi,switchpoint_lo);
631+
currTLI,switchpoint_hi,switchpoint_lo);
632632

633633
/* we ignore the remainder of each line */
634634
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp