Skip to content

Commit

Permalink
Support PostgreSQL v16 (#255)
Browse files Browse the repository at this point in the history
* Support PostgreSQL v16
* Remove unnecessary variables
  • Loading branch information
zwyan0 authored Nov 27, 2023
1 parent ba81b03 commit af50e46
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 20 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- master
- REL_16_STABLE
- REL_15_STABLE
- REL_14_STABLE
- REL_13_STABLE
Expand All @@ -12,6 +13,7 @@ on:
pull_request:
branches:
- master
- REL_16_STABLE
- REL_15_STABLE
- REL_14_STABLE
- REL_13_STABLE
Expand Down Expand Up @@ -41,11 +43,11 @@ jobs:
shell: bash -xe {0}
run: |
declare -A versions=(
["master"]="15.1"
["REL_15_STABLE"]="15.1"
["REL_14_STABLE"]="14.6"
["REL_13_STABLE"]="13.9"
["REL_12_STABLE"]="12.13"
["master"]="16.1"
["REL_15_STABLE"]="15.5"
["REL_14_STABLE"]="14.10"
["REL_13_STABLE"]="13.13"
["REL_12_STABLE"]="12.17"
["REL_11_STABLE"]="11.18"
)
[ -z "${versions[${{ env.BRANCH }}]}" ] && exit 1 # check if the key exists
Expand Down
22 changes: 11 additions & 11 deletions data.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@ parse_page(int blkno,
*/
*lsn = PageXLogRecPtrGet(header->pd_lsn);

if (PageGetPageSize(header) == BLCKSZ &&
PageGetPageLayoutVersion(header) == PG_PAGE_LAYOUT_VERSION &&
if (PageGetPageSize(pagedata) == BLCKSZ &&
PageGetPageLayoutVersion(pagedata) == PG_PAGE_LAYOUT_VERSION &&
(header->pd_flags & ~PD_VALID_FLAG_BITS) == 0 &&
header->pd_lower >= SizeOfPageHeaderData &&
header->pd_lower <= header->pd_upper &&
Expand Down Expand Up @@ -270,7 +270,7 @@ backup_data_file(const char *from_root,
BlockNumber blknum;
BlockNumber segno;
size_t read_len;
int errno_tmp;
int errno_tmp = 0;
pg_crc32c crc;
#ifdef HAVE_LIBZ
z_stream z;
Expand Down Expand Up @@ -308,7 +308,7 @@ backup_data_file(const char *from_root,
out = fopen(to_path, "w");
if (out == NULL)
{
int errno_tmp = errno;
errno_tmp = errno;
fclose(in);
ereport(ERROR,
(errcode(ERROR_SYSTEM),
Expand Down Expand Up @@ -417,7 +417,7 @@ backup_data_file(const char *from_root,
fwrite(page.data, 1, header.hole_offset, out) != header.hole_offset ||
fwrite(page.data + upper_offset, 1, upper_length, out) != upper_length)
{
int errno_tmp = errno;
errno_tmp = errno;
/* oops */
fclose(in);
fclose(out);
Expand Down Expand Up @@ -474,7 +474,7 @@ backup_data_file(const char *from_root,
{
if (fwrite(&header, 1, sizeof(header), out) != sizeof(header))
{
int errno_tmp = errno;
errno_tmp = errno;
/* oops */
fclose(in);
fclose(out);
Expand All @@ -498,7 +498,7 @@ backup_data_file(const char *from_root,
{
if (fwrite(page.data, 1, read_len, out) != read_len)
{
int errno_tmp = errno;
errno_tmp = errno;
/* oops */
fclose(in);
fclose(out);
Expand Down Expand Up @@ -539,7 +539,7 @@ backup_data_file(const char *from_root,
{
if (fwrite(&header, 1, sizeof(header), out) != sizeof(header))
{
int errno_tmp = errno;
errno_tmp = errno;
/* oops */
fclose(in);
fclose(out);
Expand Down Expand Up @@ -588,7 +588,7 @@ backup_data_file(const char *from_root,
*/
if (!check && chmod(to_path, FILE_PERMISSION) == -1)
{
int errno_tmp = errno;
errno_tmp = errno;

fclose(in);
fclose(out);
Expand Down Expand Up @@ -879,7 +879,7 @@ copy_file(const char *from_root, const char *to_root, pgFile *file,
FILE *in;
FILE *out;
size_t read_len = 0;
int errno_tmp;
int errno_tmp = 0;
char buf[8192];
struct stat st;
pg_crc32c crc;
Expand Down Expand Up @@ -921,7 +921,7 @@ copy_file(const char *from_root, const char *to_root, pgFile *file,
out = fopen(to_path, "w");
if (out == NULL)
{
int errno_tmp = errno;
errno_tmp = errno;
fclose(in);
ereport(ERROR,
(errcode(ERROR_SYSTEM),
Expand Down
7 changes: 3 additions & 4 deletions restore.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ do_restore(const char *target_time,
*/
if (!check)
{
int i;
int x;

if (verbose)
printf(_("----------------------------------------\n"));
Expand All @@ -280,7 +280,7 @@ do_restore(const char *target_time,
dir_list_file(files, pgdata, NULL, false, false);
parray_qsort(files, pgFileComparePathDesc); /* delete from leaf */

for (i = 0; i < parray_num(files); i++)
for (x = 0; x < parray_num(files); x++)
{
pgFile *file = (pgFile *) parray_get(files, i);
pgFileDelete(file);
Expand Down Expand Up @@ -1230,9 +1230,8 @@ readTimeLineHistory(TimeLineID targetTLI)
elog(DEBUG, "the calculated branch history is as below;");
for (i = 0; i < parray_num(result); i++)
{
pgTimeLine *timeline = parray_get(result, i);
elog(DEBUG, "stage %d: timeline ID = %d",
(int)parray_num(result) - i, timeline->tli);
(int)parray_num(result) - i, ((pgTimeLine *)(parray_get(result,i)))->tli);
}

return result;
Expand Down

0 comments on commit af50e46

Please sign in to comment.