1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-05 00:28:52 +02:00

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.
This commit is contained in:
David Steele
2023-04-27 10:30:50 +03:00
committed by GitHub
parent 39059dc4e7
commit 3fc3690dd7
15 changed files with 89 additions and 12 deletions

View File

@ -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"/>

View File

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

View File

@ -134,11 +134,6 @@ typedef struct
uint32 xrecoff; /* low bits */
} PageXLogRecPtr;
// PageXLogRecPtrGet macro
// ---------------------------------------------------------------------------------------------------------------------------------
#define PageXLogRecPtrGet(val) \
((uint64) (val).xlogid << 32 | (val).xrecoff)
// PageHeaderData type
// ---------------------------------------------------------------------------------------------------------------------------------
/*

View File

@ -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 */

View File

@ -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

View File

@ -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:

View File

@ -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,7 +529,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_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

View File

@ -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,
],
},
};

View File

@ -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 .=

View File

@ -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}))

View File

@ -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

View File

@ -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,

View File

@ -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

View File

@ -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);