pgbackrest.git / summary / log / commit / refs

commit    3fc3690dd77ef5fa032abb006558184164db53ec
Author:   David Steele <david@pgmasters.net>
Commit:   GitHub <noreply@github.com>
Date:     Thu Apr 27 07:30:50 2023 +0000

    PostgreSQL 16 Support.
    
    Add catalog version and WAL magic for PostgreSQL 16.
    
    The GUC to force parallel mode has be renamed so update that in the tests.


doc/xml/release.xml | 13 +++++++++++++ src/build/postgres/postgres.yaml | 2 ++ src/postgres/interface/static.vendor.h | 5 ----- src/postgres/interface/version.vendor.h | 17 +++++++++++++++++ src/postgres/version.auto.h | 4 +++- test/container.yaml | 5 ++++- test/lib/pgBackRestTest/Common/ContainerTest.pm | 12 +++++++++--- test/lib/pgBackRestTest/Common/DbVersion.pm | 4 +++- test/lib/pgBackRestTest/Common/VmTest.pm | 2 ++ test/lib/pgBackRestTest/Env/Host/HostDbTest.pm | 11 ++++++++++- test/lib/pgBackRestTest/Env/HostEnvTest.pm | 2 ++ test/lib/pgBackRestTest/Module/Real/RealAllTest.pm | 1 + test/src/common/harnessPostgres.c | 11 +++++++++++ test/src/common/harnessPostgres.h | 2 ++ test/src/common/harnessPostgres/harness160.c | 10 ++++++++++ 15 files changed, 89 insertions(+), 12 deletions(-) diff --git a/doc/xml/release.xml b/doc/xml/release.xml index 3f8fd469b..b5d90d721 100644 --- a/doc/xml/release.xml +++ b/doc/xml/release.xml @@ -16,6 +16,19 @@ <release-list> <release date="XXXX-XX-XX" version="2.46dev" title="UNDER DEVELOPMENT"> <release-core-list> + <release-feature-list> + <release-item> + <github-pull-request id="2051"/> + + <release-item-contributor-list> + <release-item-contributor id="david.steele"/> + <release-item-reviewer id="stefan.fercot"/> + </release-item-contributor-list> + + <p><postgres/> 16 support.</p> + </release-item> + </release-feature-list> + <release-improvement-list> <release-item> <github-pull-request id="2045"/> diff --git a/src/build/postgres/postgres.yaml b/src/build/postgres/postgres.yaml index dcf278b3a..3aef7ccf8 100644 --- a/src/build/postgres/postgres.yaml +++ b/src/build/postgres/postgres.yaml @@ -15,3 +15,5 @@ version: - 13 - 14 - 15 + - 16: + release: false diff --git a/src/postgres/interface/static.vendor.h b/src/postgres/interface/static.vendor.h index dd660edab..210a4bc3d 100644 --- a/src/postgres/interface/static.vendor.h +++ b/src/postgres/interface/static.vendor.h @@ -134,11 +134,6 @@ typedef struct uint32 xrecoff; /* low bits */ } PageXLogRecPtr; -// PageXLogRecPtrGet macro -// --------------------------------------------------------------------------------------------------------------------------------- -#define PageXLogRecPtrGet(val) \ - ((uint64) (val).xlogid << 32 | (val).xrecoff) - // PageHeaderData type // --------------------------------------------------------------------------------------------------------------------------------- /* diff --git a/src/postgres/interface/version.vendor.h b/src/postgres/interface/version.vendor.h index 7d175861e..70b233784 100644 --- a/src/postgres/interface/version.vendor.h +++ b/src/postgres/interface/version.vendor.h @@ -158,6 +158,19 @@ Types from src/include/catalog/catversion.h // --------------------------------------------------------------------------------------------------------------------------------- #if PG_VERSION > PG_VERSION_MAX +#elif PG_VERSION >= PG_VERSION_16 + +/* + * 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 202304110 + #elif PG_VERSION >= PG_VERSION_15 /* @@ -1708,6 +1721,10 @@ Types from src/include/access/xlog_internal.h // --------------------------------------------------------------------------------------------------------------------------------- #if PG_VERSION > PG_VERSION_MAX +#elif PG_VERSION >= PG_VERSION_16 + +#define XLOG_PAGE_MAGIC 0xD113 /* can be used as WAL version indicator */ + #elif PG_VERSION >= PG_VERSION_15 #define XLOG_PAGE_MAGIC 0xD110 /* can be used as WAL version indicator */ diff --git a/src/postgres/version.auto.h b/src/postgres/version.auto.h index 5e48f9bea..7aea0b1a0 100644 --- a/src/postgres/version.auto.h +++ b/src/postgres/version.auto.h @@ -19,8 +19,9 @@ PostgreSQL version constants #define PG_VERSION_13 130000 #define PG_VERSION_14 140000 #define PG_VERSION_15 150000 +#define PG_VERSION_16 160000 -#define PG_VERSION_MAX PG_VERSION_15 +#define PG_VERSION_MAX PG_VERSION_16 /*********************************************************************************************************************************** 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_13_Z "13" #define PG_VERSION_14_Z "14" #define PG_VERSION_15_Z "15" +#define PG_VERSION_16_Z "16" #endif diff --git a/test/container.yaml b/test/container.yaml index c8aae6be1..a88671a1a 100644 --- a/test/container.yaml +++ b/test/container.yaml @@ -12,6 +12,10 @@ # - docker login -u pgbackrest # - VM=XXX;DATE=YYYYMMDDX;BASE=pgbackrest/test:${VM?}-base;docker tag ${BASE?} ${BASE?}-${DATE?} && docker push ${BASE?}-${DATE?} # ********************************************************************************************************************************** +20230427A: + x86_64: + u22: 6a07d63ae869c3d84d1bf6622826df9fe768691d + 20230405A: x86_64: d10: 01a943f8d68ee5bbb2a5ee10cc474925c6cc0cde @@ -19,7 +23,6 @@ 20221220A: x86_64: u20: 2db467d873c0aff06335592c8a22b8441b5c6440 - u22: 165882634c773173470021ce992a53258a84bbbf 20220726A: x86_64: diff --git a/test/lib/pgBackRestTest/Common/ContainerTest.pm b/test/lib/pgBackRestTest/Common/ContainerTest.pm index 96704534d..8f4913b02 100644 --- a/test/lib/pgBackRestTest/Common/ContainerTest.pm +++ b/test/lib/pgBackRestTest/Common/ContainerTest.pm @@ -507,9 +507,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 16\"" . + " >> /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"; } @@ -525,8 +529,10 @@ 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 foreach my $strDbVersion (@{$oOS->{&VM_DB}}) diff --git a/test/lib/pgBackRestTest/Common/DbVersion.pm b/test/lib/pgBackRestTest/Common/DbVersion.pm index 4ce51a26d..f5bbaa6aa 100644 --- a/test/lib/pgBackRestTest/Common/DbVersion.pm +++ b/test/lib/pgBackRestTest/Common/DbVersion.pm @@ -35,6 +35,8 @@ use constant PG_VERSION_14 => '14'; push @EXPORT, qw(PG_VERSION_14); use constant PG_VERSION_15 => '15'; push @EXPORT, qw(PG_VERSION_15); +use constant PG_VERSION_16 => '16'; + push @EXPORT, qw(PG_VERSION_16); #################################################################################################################################### # versionSupport @@ -47,7 +49,7 @@ sub versionSupport my ($strOperation) = logDebugParam(__PACKAGE__ . '->versionSupport'); my @strySupportVersion = (PG_VERSION_93, 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_12, PG_VERSION_13, PG_VERSION_14, PG_VERSION_15, PG_VERSION_16); # Return from function and log return values if any return logDebugReturn diff --git a/test/lib/pgBackRestTest/Common/VmTest.pm b/test/lib/pgBackRestTest/Common/VmTest.pm index 6ed126055..871108844 100644 --- a/test/lib/pgBackRestTest/Common/VmTest.pm +++ b/test/lib/pgBackRestTest/Common/VmTest.pm @@ -262,6 +262,7 @@ my $oyVm = PG_VERSION_13, PG_VERSION_14, PG_VERSION_15, + PG_VERSION_16, ], &VM_DB_TEST => @@ -269,6 +270,7 @@ my $oyVm = PG_VERSION_95, PG_VERSION_96, PG_VERSION_15, + PG_VERSION_16, ], }, }; diff --git a/test/lib/pgBackRestTest/Env/Host/HostDbTest.pm b/test/lib/pgBackRestTest/Env/Host/HostDbTest.pm index 1ec2655e6..5b680445f 100644 --- a/test/lib/pgBackRestTest/Env/Host/HostDbTest.pm +++ b/test/lib/pgBackRestTest/Env/Host/HostDbTest.pm @@ -436,7 +436,16 @@ sub clusterStart # works since pg_stop_backup() is marked parallel safe and will error if run in a worker. if ($self->pgVersion() >= PG_VERSION_96) { - $strCommand .= " -c force_parallel_mode='on' -c max_parallel_workers_per_gather=2"; + if ($self->pgVersion() >= PG_VERSION_16) + { + $strCommand .= " -c debug_parallel_query='on'"; + } + else + { + $strCommand .= " -c force_parallel_mode='on'"; + } + + $strCommand .= " -c max_parallel_workers_per_gather=2"; } $strCommand .= diff --git a/test/lib/pgBackRestTest/Env/HostEnvTest.pm b/test/lib/pgBackRestTest/Env/HostEnvTest.pm index 0970303fe..680840d1e 100644 --- a/test/lib/pgBackRestTest/Env/HostEnvTest.pm +++ b/test/lib/pgBackRestTest/Env/HostEnvTest.pm @@ -254,6 +254,7 @@ sub dbCatalogVersion &PG_VERSION_13 => 202007201, &PG_VERSION_14 => 202105121, &PG_VERSION_15 => 202209061, + &PG_VERSION_16 => 202304110, }; if (!defined($hCatalogVersion->{$strPgVersion})) @@ -295,6 +296,7 @@ sub dbControlVersion &PG_VERSION_13 => 1300, &PG_VERSION_14 => 1300, &PG_VERSION_15 => 1300, + &PG_VERSION_16 => 1300, }; if (!defined($hControlVersion->{$strPgVersion})) diff --git a/test/lib/pgBackRestTest/Module/Real/RealAllTest.pm b/test/lib/pgBackRestTest/Module/Real/RealAllTest.pm index ed95f95d1..48777d361 100644 --- a/test/lib/pgBackRestTest/Module/Real/RealAllTest.pm +++ b/test/lib/pgBackRestTest/Module/Real/RealAllTest.pm @@ -62,6 +62,7 @@ sub run {pg => '13', dst => 'db-standby', tls => 1, stg => GCS, enc => 0, cmp => ZST, rt => 1, bnd => 1, bi => 1}, {pg => '14', dst => 'backup', tls => 0, stg => POSIX, enc => 1, cmp => LZ4, rt => 2, bnd => 0, bi => 0}, {pg => '15', dst => 'db-standby', tls => 0, stg => AZURE, enc => 0, cmp => NONE, rt => 2, bnd => 1, bi => 1}, + {pg => '16', dst => 'db-standby', tls => 0, stg => S3, enc => 1, cmp => NONE, rt => 1, bnd => 0, bi => 0}, ) { # Only run tests for this pg version diff --git a/test/src/common/harnessPostgres.c b/test/src/common/harnessPostgres.c index 5bcbf61a5..b4c2fe367 100644 --- a/test/src/common/harnessPostgres.c +++ b/test/src/common/harnessPostgres.c @@ -51,6 +51,10 @@ uint32_t hrnPgInterfaceCatalogVersion150(void); void hrnPgInterfaceControl150(unsigned int controlVersion, PgControl pgControl, unsigned char *buffer); void hrnPgInterfaceWal150(unsigned int magic, PgWal pgWal, unsigned char *buffer); +uint32_t hrnPgInterfaceCatalogVersion160(void); +void hrnPgInterfaceControl160(unsigned int controlVersion, PgControl pgControl, unsigned char *buffer); +void hrnPgInterfaceWal160(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_16, + + .catalogVersion = hrnPgInterfaceCatalogVersion160, + .control = hrnPgInterfaceControl160, + .wal = hrnPgInterfaceWal160, + }, { .version = PG_VERSION_15, diff --git a/test/src/common/harnessPostgres.h b/test/src/common/harnessPostgres.h index 7b8e9fe7f..d53de9d39 100644 --- a/test/src/common/harnessPostgres.h +++ b/test/src/common/harnessPostgres.h @@ -39,6 +39,8 @@ System id constants by version #define HRN_PG_SYSTEMID_14_Z "10000000000000140000" #define HRN_PG_SYSTEMID_15 (10000000000000000000ULL + (uint64_t)PG_VERSION_15) #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" /*********************************************************************************************************************************** Put a control file to storage diff --git a/test/src/common/harnessPostgres/harness160.c b/test/src/common/harnessPostgres/harness160.c new file mode 100644 index 000000000..5b24485a9 --- /dev/null +++ b/test/src/common/harnessPostgres/harness160.c @@ -0,0 +1,10 @@ +/*********************************************************************************************************************************** +Harness for PostgreSQL Interface (see PG_VERSION for version) +***********************************************************************************************************************************/ +#include "build.auto.h" + +#define PG_VERSION PG_VERSION_16 + +#include "common/harnessPostgres/harnessVersion.intern.h" + +HRN_PG_INTERFACE(160); [parent: 39059dc4e7a7]