Skip to content

Commit 0148fa8

Browse files
japinliOleg Gurev
authored andcommitted
Fix warning about shadows a previous local variable
1 parent b803c07 commit 0148fa8

File tree

3 files changed

+60
-60
lines changed

3 files changed

+60
-60
lines changed

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
int 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 */
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
TimeLineID 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)
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-
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 */
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
XLogSegNo segno = 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
XLogSegNo 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))
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/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-
TimeLineID tli;
595+
TimeLineID currTLI;
596596
uint32 switchpoint_hi;
597597
uint32 switchpoint_lo;
598598
int nfields;
@@ -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
}

src/utils/file.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2499,21 +2499,21 @@ fio_send_pages_impl(int out, char* buf)
24992499
int
25002500
fio_send_file_gz(const char *from_fullpath, FILE* out, char **errormsg)
25012501
{
2502-
fio_header hdr;
2502+
fio_header header;
25032503
int exit_code = SEND_OK;
25042504
char *in_buf = pgut_malloc(CHUNK_SIZE); /* buffer for compressed data */
25052505
char *out_buf = pgut_malloc(OUT_BUF_SIZE); /* 1MB buffer for decompressed data */
25062506
size_t path_len = strlen(from_fullpath) + 1;
25072507
/* decompressor */
25082508
z_stream *strm = NULL;
25092509

2510-
hdr.cop = FIO_SEND_FILE;
2511-
hdr.size = path_len;
2510+
header.cop = FIO_SEND_FILE;
2511+
header.size = path_len;
25122512

25132513
// elog(VERBOSE, "Thread [%d]: Attempting to open remote compressed WAL file '%s'",
25142514
// thread_num, from_fullpath);
25152515

2516-
IO_CHECK(fio_write_all(fio_stdout, &hdr, sizeof(hdr)), sizeof(hdr));
2516+
IO_CHECK(fio_write_all(fio_stdout, &header, sizeof(header)), sizeof(header));
25172517
IO_CHECK(fio_write_all(fio_stdout, from_fullpath, path_len), path_len);
25182518

25192519
for (;;)

0 commit comments

Comments
 (0)