@@ -1755,27 +1755,27 @@ catalog_get_timelines(InstanceState *instanceState, InstanceConfig *instance)
17551755
17561756for (i = 0 ;i < parray_num (timelineinfos );i ++ )
17571757{
1758- timelineInfo * tlinfo = parray_get (timelineinfos ,i );
1758+ timelineInfo * tlInfo = parray_get (timelineinfos ,i );
17591759for (j = 0 ;j < parray_num (backups );j ++ )
17601760{
17611761pgBackup * 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 */
17731773for (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)
18451845for (i = 0 ;i < parray_num (timelineinfos );i ++ )
18461846{
18471847int count = 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 */
18621862if (XLogRecPtrIsInvalid (backup -> start_lsn )||
@@ -1886,12 +1886,12 @@ catalog_get_timelines(InstanceState *instanceState, InstanceConfig *instance)
18861886if (count == instance -> wal_depth )
18871887{
18881888elog (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 ;
18951895break ;
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)
19421942xlogInterval * interval = NULL ;
19431943TimeLineID tli = 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)
19521952continue ;
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 )
19571957continue ;
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- XLogRecPtr switchpoint = tlinfo -> switchpoint ;
1982+ XLogRecPtr switchpoint = 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 */
19901990interval = palloc (sizeof (xlogInterval ));
19911991GetXLogSegNo (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 */
19971997else
19981998GetXLogSegNo (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
20082008elog (LOG ,"Timeline %i to stay reachable from timeline %i "
20092009"protect from purge WAL interval between "
20102010"%s and %s on timeline %i" ,
20112011tli ,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 );
20152015continue ;
20162016}
20172017continue ;
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{
20232023XLogSegNo segno = 0 ;
20242024xlogInterval * 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)
20392039continue ;
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 )
20432043continue ;
20442044
20452045/* append interval to keep_segments */
@@ -2057,19 +2057,19 @@ catalog_get_timelines(InstanceState *instanceState, InstanceConfig *instance)
20572057else
20582058interval -> 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
20632063elog (LOG ,"Archive backup %s to stay consistent "
20642064"protect from purge WAL interval "
20652065"between %s and %s on timeline %i" ,
20662066backup_id_of (backup ),
20672067begin_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)
20812081for (i = 0 ;i < parray_num (timelineinfos );i ++ )
20822082{
20832083XLogSegNo anchor_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 ))
20912091continue ;
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 )
20982098continue ;
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
21062106if (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 )
21142114continue ;
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
21212121if ((wal_file -> segno >=keep_segments -> begin_segno )&&
21222122wal_file -> segno <=keep_segments -> end_segno )