1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-01-18 04:58:51 +02:00

PostgreSQL 17 Support.

Add catalog version and WAL magic for PostgreSQL 17.
This commit is contained in:
David Steele 2024-04-18 10:56:24 +10:00 committed by GitHub
parent c8cf8e1f2b
commit fb22f04555
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 82 additions and 12 deletions

View File

@ -13,6 +13,17 @@
<p><proper>S3</proper> <id>SSE-C</id> encryption support.</p>
</release-item>
<release-item>
<github-pull-request id="2328"/>
<release-item-contributor-list>
<release-item-contributor id="david.steele"/>
<release-item-reviewer id="stefan.fercot"/>
</release-item-contributor-list>
<p><proper>PostgreSQL</proper> 17 support. </p>
</release-item>
</release-feature-list>
<release-improvement-list>

View File

@ -15,3 +15,5 @@ version:
- 14
- 15
- 16
- 17:
release: false

View File

@ -158,6 +158,19 @@ Types from src/include/catalog/catversion.h
// ---------------------------------------------------------------------------------------------------------------------------------
#if PG_VERSION > PG_VERSION_MAX
#elif PG_VERSION >= PG_VERSION_17
/*
* We could use anything we wanted for version numbers, but I recommend
* following the "YYYYMMDDN" style often used for DNS zone serial numbers.
* YYYYMMDD are the date of the change, and N is the number of the change
* on that day. (Hopefully we'll never commit ten independent sets of
* catalog changes on the same day...)
*/
/* yyyymmddN */
#define CATALOG_VERSION_NO 202404021
#elif PG_VERSION >= PG_VERSION_16
/*
@ -576,7 +589,7 @@ typedef enum DBState
DB_SHUTDOWNING,
DB_IN_CRASH_RECOVERY,
DB_IN_ARCHIVE_RECOVERY,
DB_IN_PRODUCTION
DB_IN_PRODUCTION,
} DBState;
#endif
@ -1567,6 +1580,10 @@ Types from src/include/access/xlog_internal.h
// ---------------------------------------------------------------------------------------------------------------------------------
#if PG_VERSION > PG_VERSION_MAX
#elif PG_VERSION >= PG_VERSION_17
#define XLOG_PAGE_MAGIC 0xD115 /* can be used as WAL version indicator */
#elif PG_VERSION >= PG_VERSION_16
#define XLOG_PAGE_MAGIC 0xD113 /* can be used as WAL version indicator */

View File

@ -19,8 +19,9 @@ PostgreSQL version constants
#define PG_VERSION_14 140000
#define PG_VERSION_15 150000
#define PG_VERSION_16 160000
#define PG_VERSION_17 170000
#define PG_VERSION_MAX PG_VERSION_16
#define PG_VERSION_MAX PG_VERSION_17
/***********************************************************************************************************************************
PostgreSQL version string constants for use in error messages
@ -35,5 +36,6 @@ PostgreSQL version string constants for use in error messages
#define PG_VERSION_14_Z "14"
#define PG_VERSION_15_Z "15"
#define PG_VERSION_16_Z "16"
#define PG_VERSION_17_Z "17"
#endif

View File

@ -12,11 +12,14 @@
# - docker login -u pgbackrest
# - VM=XXX;DATE=YYYYMMDDX;BASE=pgbackrest/test:${VM?}-base;docker tag ${BASE?} ${BASE?}-${DATE?} && docker push ${BASE?}-${DATE?}
# **********************************************************************************************************************************
20240417A:
x86_64:
u22: 287933d006d8780a521dac6409f4910ebafe6ded
20231109A:
x86_64:
d10: 927b594d0f0319c19d692947f9218a4474cf8cd6
u20: 51041e6806d2d05ccefbd8a2ab23f2c9e42a7997
u22: 287933d006d8780a521dac6409f4910ebafe6ded
20230622A:
x86_64:

View File

@ -510,9 +510,13 @@ sub containerBuild
$strScript .=
" echo \"deb http://apt.postgresql.org/pub/repos/apt/ \$(lsb_release -s -c)-pgdg main" .
"\" >> /etc/apt/sources.list.d/pgdg.list && \\\n" .
($strOS eq VM_U22 ?
" echo \"deb http://apt.postgresql.org/pub/repos/apt/ \$(lsb_release -s -c)-pgdg-snapshot main 17\"" .
" >> /etc/apt/sources.list.d/pgdg.list && \\\n" : '') .
" wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && \\\n" .
" apt-get update && \\\n" .
" apt-get install -y --no-install-recommends postgresql-common libpq-dev && \\\n" .
" apt-get install -y --no-install-recommends" .
($strOS eq VM_U22 ? " -t \$(lsb_release -s -c)-pgdg-snapshot" : '') . " postgresql-common libpq-dev && \\\n" .
" sed -i 's/^\\#create\\_main\\_cluster.*\$/create\\_main\\_cluster \\= false/' " .
"/etc/postgresql-common/createcluster.conf";
}
@ -528,7 +532,9 @@ sub containerBuild
}
else
{
$strScript .= " apt-get install -y --no-install-recommends";
$strScript .=
" apt-get install -y --no-install-recommends" .
($strOS eq VM_U22 ? " -t \$(lsb_release -s -c)-pgdg-snapshot" : '');
}
# Construct list of databases to install

View File

@ -35,6 +35,8 @@ use constant PG_VERSION_15 => '15';
push @EXPORT, qw(PG_VERSION_15);
use constant PG_VERSION_16 => '16';
push @EXPORT, qw(PG_VERSION_16);
use constant PG_VERSION_17 => '17';
push @EXPORT, qw(PG_VERSION_17);
####################################################################################################################################
# versionSupport
@ -47,7 +49,7 @@ sub versionSupport
my ($strOperation) = logDebugParam(__PACKAGE__ . '->versionSupport');
my @strySupportVersion = (PG_VERSION_94, PG_VERSION_95, PG_VERSION_96, PG_VERSION_10, PG_VERSION_11, PG_VERSION_12,
PG_VERSION_13, PG_VERSION_14, PG_VERSION_15, PG_VERSION_16);
PG_VERSION_13, PG_VERSION_14, PG_VERSION_15, PG_VERSION_16, PG_VERSION_17);
# Return from function and log return values if any
return logDebugReturn

View File

@ -174,6 +174,7 @@ my $oyVm =
PG_VERSION_12,
PG_VERSION_13,
PG_VERSION_14,
PG_VERSION_15,
],
},
@ -258,14 +259,15 @@ my $oyVm =
PG_VERSION_14,
PG_VERSION_15,
PG_VERSION_16,
PG_VERSION_17,
],
&VM_DB_TEST =>
[
PG_VERSION_95,
PG_VERSION_10,
PG_VERSION_15,
PG_VERSION_16,
PG_VERSION_17,
],
},
};

View File

@ -51,6 +51,10 @@ uint32_t hrnPgInterfaceCatalogVersion160(void);
void hrnPgInterfaceControl160(unsigned int controlVersion, unsigned int crc, PgControl pgControl, unsigned char *buffer);
void hrnPgInterfaceWal160(unsigned int magic, PgWal pgWal, unsigned char *buffer);
uint32_t hrnPgInterfaceCatalogVersion170(void);
void hrnPgInterfaceControl170(unsigned int controlVersion, unsigned int crc, PgControl pgControl, unsigned char *buffer);
void hrnPgInterfaceWal170(unsigned int magic, PgWal pgWal, unsigned char *buffer);
typedef struct HrnPgInterface
{
// Version of PostgreSQL supported by this interface
@ -68,6 +72,13 @@ typedef struct HrnPgInterface
static const HrnPgInterface hrnPgInterface[] =
{
{
.version = PG_VERSION_17,
.catalogVersion = hrnPgInterfaceCatalogVersion170,
.control = hrnPgInterfaceControl170,
.wal = hrnPgInterfaceWal170,
},
{
.version = PG_VERSION_16,

View File

@ -39,6 +39,8 @@ System id constants by version
#define HRN_PG_SYSTEMID_15_Z "10000000000000150000"
#define HRN_PG_SYSTEMID_16 (10000000000000000000ULL + (uint64_t)PG_VERSION_16)
#define HRN_PG_SYSTEMID_16_Z "10000000000000160000"
#define HRN_PG_SYSTEMID_17 (10000000000000000000ULL + (uint64_t)PG_VERSION_17)
#define HRN_PG_SYSTEMID_17_Z "10000000000000170000"
/***********************************************************************************************************************************
Put a control file to storage

View File

@ -0,0 +1,10 @@
/***********************************************************************************************************************************
Harness for PostgreSQL Interface (see PG_VERSION for version)
***********************************************************************************************************************************/
#include "build.auto.h"
#define PG_VERSION PG_VERSION_17
#include "common/harnessPostgres/harnessVersion.intern.h"
HRN_PG_INTERFACE(170);

View File

@ -28,6 +28,7 @@ static HrnHostTestDefine testMatrix[] =
{.pg = "14", .repo = "repo", .tls = 0, .stg = "gcs", .enc = 0, .cmp = "lz4", .rt = 1, .bnd = 1, .bi = 0},
{.pg = "15", .repo = "pg2", .tls = 0, .stg = "azure", .enc = 0, .cmp = "none", .rt = 2, .bnd = 1, .bi = 1},
{.pg = "16", .repo = "repo", .tls = 0, .stg = "posix", .enc = 0, .cmp = "none", .rt = 1, .bnd = 0, .bi = 0},
{.pg = "17", .repo = "repo", .tls = 0, .stg = "posix", .enc = 0, .cmp = "none", .rt = 1, .bnd = 0, .bi = 0},
// {uncrustify_on}
};

View File

@ -61,6 +61,7 @@ testRun(void)
"HINT: is this version of PostgreSQL supported?");
TEST_RESULT_UINT(pgControlVersion(PG_VERSION_94), 942, "9.4 control version");
TEST_RESULT_UINT(pgControlVersion(PG_VERSION_11), 1100, "11 control version");
TEST_RESULT_UINT(pgControlVersion(PG_VERSION_17), 1300, "17 control version");
}
// *****************************************************************************************************************************
@ -146,7 +147,7 @@ testRun(void)
pgControlFromFile(storageTest, NULL), FormatError,
"wal segment size is 47 but must be a power of two between 1048576 and 1073741824 inclusive");
HRN_PG_CONTROL_PUT(storageTest, PG_VERSION_11, .walSegmentSize = (unsigned int)2 * 1024 * 1024 * 1024);
HRN_PG_CONTROL_PUT(storageTest, PG_VERSION_17, .walSegmentSize = (unsigned int)2 * 1024 * 1024 * 1024);
TEST_ERROR(
pgControlFromFile(storageTest, NULL), FormatError,
@ -231,13 +232,13 @@ testRun(void)
TEST_RESULT_UINT(info.pageSize, pgPageSize16, "check page size");
HRN_PG_CONTROL_PUT(
storageTest, PG_VERSION_16, .systemId = 0xEFEFEFEFEF, .catalogVersion = hrnPgCatalogVersion(PG_VERSION_16),
storageTest, PG_VERSION_17, .systemId = 0xEFEFEFEFEF, .catalogVersion = hrnPgCatalogVersion(PG_VERSION_17),
.checkpoint = 0xAABBAABBEEFFEEFF, .timeline = 88, .pageSize = pgPageSize32);
TEST_ASSIGN(info, pgControlFromFile(storageTest, NULL), "get control info");
TEST_RESULT_UINT(info.systemId, 0xEFEFEFEFEF, " check system id");
TEST_RESULT_UINT(info.version, PG_VERSION_16, "check version");
TEST_RESULT_UINT(info.catalogVersion, 202307071, "check catalog version");
TEST_RESULT_UINT(info.systemId, 0xEFEFEFEFEF, "check system id");
TEST_RESULT_UINT(info.version, PG_VERSION_17, "check version");
TEST_RESULT_UINT(info.catalogVersion, 202404021, "check catalog version");
TEST_RESULT_UINT(info.checkpoint, 0xAABBAABBEEFFEEFF, "check checkpoint");
TEST_RESULT_UINT(info.timeline, 88, "check timeline");
TEST_RESULT_UINT(info.pageSize, pgPageSize32, "check page size");