Skip to content

Commit eb5ccf9

Browse files
committed
PBCKP-751: Fixed for PG 16 build and removed some compilation warnings.
1 parent 9762426 commit eb5ccf9

File tree

6 files changed

+17
-15
lines changed

6 files changed

+17
-15
lines changed

Diff for: po/LINGUAS

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ru

Diff for: src/data.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ page_may_be_compressed(Page page, CompressAlg alg, uint32 backup_version)
142142
phdr = (PageHeader) page;
143143

144144
/* First check if page header is valid (it seems to be fast enough check) */
145-
if (!(PageGetPageSize(phdr) == BLCKSZ &&
145+
if (!(PageGetPageSize(page) == BLCKSZ &&
146146
// PageGetPageLayoutVersion(phdr) == PG_PAGE_LAYOUT_VERSION &&
147147
(phdr->pd_flags & ~PD_VALID_FLAG_BITS) == 0 &&
148148
phdr->pd_lower >= SizeOfPageHeaderData &&
@@ -181,7 +181,7 @@ parse_page(Page page, XLogRecPtr *lsn)
181181
/* Get lsn from page header */
182182
*lsn = PageXLogRecPtrGet(phdr->pd_lsn);
183183

184-
if (PageGetPageSize(phdr) == BLCKSZ &&
184+
if (PageGetPageSize(page) == BLCKSZ &&
185185
// PageGetPageLayoutVersion(phdr) == PG_PAGE_LAYOUT_VERSION &&
186186
(phdr->pd_flags & ~PD_VALID_FLAG_BITS) == 0 &&
187187
phdr->pd_lower >= SizeOfPageHeaderData &&
@@ -203,10 +203,10 @@ get_header_errormsg(Page page, char **errormsg)
203203
PageHeader phdr = (PageHeader) page;
204204
*errormsg = pgut_malloc(ERRMSG_MAX_LEN);
205205

206-
if (PageGetPageSize(phdr) != BLCKSZ)
206+
if (PageGetPageSize(page) != BLCKSZ)
207207
snprintf(*errormsg, ERRMSG_MAX_LEN, "page header invalid, "
208208
"page size %lu is not equal to block size %u",
209-
PageGetPageSize(phdr), BLCKSZ);
209+
PageGetPageSize(page), BLCKSZ);
210210

211211
else if (phdr->pd_lower < SizeOfPageHeaderData)
212212
snprintf(*errormsg, ERRMSG_MAX_LEN, "page header invalid, "

Diff for: src/dir.c

-1
Original file line numberDiff line numberDiff line change
@@ -1175,7 +1175,6 @@ check_tablespace_mapping(pgBackup *backup, bool incremental, bool force, bool pg
11751175
{
11761176
pgFile *link = (pgFile *) parray_get(links, i);
11771177
const char *linked_path = link->linked;
1178-
TablespaceListCell *cell;
11791178
bool remapped = false;
11801179

11811180
for (cell = tablespace_dirs.head; cell; cell = cell->next)

Diff for: src/show.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ do_show(CatalogState *catalogState, InstanceState *instanceState,
137137
show_instance_start();
138138
for (i = 0; i < parray_num(instances); i++)
139139
{
140-
InstanceState *instanceState = parray_get(instances, i);
140+
instanceState = parray_get(instances, i);
141141

142142
if (interrupted)
143143
elog(ERROR, "Interrupted during show");
@@ -202,22 +202,22 @@ pretty_size(int64 size, char *buf, size_t len)
202202
return;
203203
}
204204

205-
if (Abs(size) < limit)
205+
if (size < limit)
206206
snprintf(buf, len, "%dB", (int) size);
207207
else
208208
{
209209
size >>= 9;
210-
if (Abs(size) < limit2)
210+
if (size < limit2)
211211
snprintf(buf, len, "%dkB", (int) half_rounded(size));
212212
else
213213
{
214214
size >>= 10;
215-
if (Abs(size) < limit2)
215+
if (size < limit2)
216216
snprintf(buf, len, "%dMB", (int) half_rounded(size));
217217
else
218218
{
219219
size >>= 10;
220-
if (Abs(size) < limit2)
220+
if (size < limit2)
221221
snprintf(buf, len, "%dGB", (int) half_rounded(size));
222222
else
223223
{

Diff for: src/stream.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,11 @@ StreamLog(void *arg)
307307
}
308308

309309
#if PG_VERSION_NUM >= 100000
310+
#if PG_VERSION_NUM >= 160000
311+
if (!ctl.walmethod->ops->finish(ctl.walmethod))
312+
#else
310313
if (!ctl.walmethod->finish())
314+
#endif
311315
{
312316
interrupted = true;
313317
elog(ERROR, "Could not finish writing WAL files: %s",
@@ -529,7 +533,7 @@ get_history_streaming(ConnectionOptions *conn_opt, TimeLineID tli, parray *backu
529533
/* link parent to child */
530534
for (i = 0; i < parray_num(tli_list); i++)
531535
{
532-
timelineInfo *tlinfo = (timelineInfo *) parray_get(tli_list, i);
536+
tlinfo = (timelineInfo *) parray_get(tli_list, i);
533537

534538
for (j = 0; j < parray_num(tli_list); j++)
535539
{
@@ -546,7 +550,7 @@ get_history_streaming(ConnectionOptions *conn_opt, TimeLineID tli, parray *backu
546550
/* add backups to each timeline info */
547551
for (i = 0; i < parray_num(tli_list); i++)
548552
{
549-
timelineInfo *tlinfo = parray_get(tli_list, i);
553+
tlinfo = parray_get(tli_list, i);
550554
for (j = 0; j < parray_num(backup_list); j++)
551555
{
552556
pgBackup *backup = parray_get(backup_list, j);

Diff for: src/validate.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,6 @@ do_validate_all(CatalogState *catalogState, InstanceState *instanceState)
401401
{
402402
char child[MAXPGPATH];
403403
struct stat st;
404-
InstanceState *instanceState;
405-
406404

407405
/* skip entries point current dir or parent dir */
408406
if (strcmp(dent->d_name, ".") == 0 ||
@@ -420,7 +418,7 @@ do_validate_all(CatalogState *catalogState, InstanceState *instanceState)
420418
/*
421419
* Initialize instance configuration.
422420
*/
423-
instanceState = pgut_new(InstanceState);
421+
instanceState = pgut_new(InstanceState); /* memory leak */
424422
strncpy(instanceState->instance_name, dent->d_name, MAXPGPATH);
425423

426424
join_path_components(instanceState->instance_backup_subdir_path,

0 commit comments

Comments
 (0)