You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-07-05 00:28:52 +02:00
Add PostgreSQL 14 support.
There are no code changes from PostgreSQL 13 so simply add the new version. Add CATALOG_VERSION_NO_MAX to allow the catalog version to "float" during the PostgreSQL beta/rc period so new pgBackRest versions are not required when the catalog version changes. Update the integration tests to handle new PostgreSQL startup messages.
This commit is contained in:
12
src/postgres/interface/v140.c
Normal file
12
src/postgres/interface/v140.c
Normal file
@ -0,0 +1,12 @@
|
||||
/***********************************************************************************************************************************
|
||||
PostgreSQL 14 Interface
|
||||
|
||||
See postgres/interface/version.intern.h for documentation.
|
||||
***********************************************************************************************************************************/
|
||||
#include "build.auto.h"
|
||||
|
||||
#define PG_VERSION PG_VERSION_14
|
||||
|
||||
#include "postgres/interface/version.intern.h"
|
||||
|
||||
PG_INTERFACE(140);
|
@ -87,4 +87,10 @@ uint32_t pgInterfaceControlVersion130(void);
|
||||
bool pgInterfaceWalIs130(const unsigned char *walFile);
|
||||
PgWal pgInterfaceWal130(const unsigned char *controlFile);
|
||||
|
||||
bool pgInterfaceControlIs140(const unsigned char *controlFile);
|
||||
PgControl pgInterfaceControl140(const unsigned char *controlFile);
|
||||
uint32_t pgInterfaceControlVersion140(void);
|
||||
bool pgInterfaceWalIs140(const unsigned char *walFile);
|
||||
PgWal pgInterfaceWal140(const unsigned char *controlFile);
|
||||
|
||||
#endif
|
||||
|
@ -24,6 +24,22 @@ Determine if the supplied pg_control is for this version of PostgreSQL
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_83
|
||||
|
||||
#ifdef CATALOG_VERSION_NO_MAX
|
||||
|
||||
#define PG_INTERFACE_CONTROL_IS(version) \
|
||||
bool \
|
||||
pgInterfaceControlIs##version(const unsigned char *controlFile) \
|
||||
{ \
|
||||
ASSERT(controlFile != NULL); \
|
||||
\
|
||||
return \
|
||||
((ControlFileData *)controlFile)->pg_control_version == PG_CONTROL_VERSION && \
|
||||
((ControlFileData *)controlFile)->catalog_version_no >= CATALOG_VERSION_NO && \
|
||||
((ControlFileData *)controlFile)->catalog_version_no < (CATALOG_VERSION_NO / 100000 + 1) * 100000; \
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define PG_INTERFACE_CONTROL_IS(version) \
|
||||
bool \
|
||||
pgInterfaceControlIs##version(const unsigned char *controlFile) \
|
||||
@ -37,6 +53,8 @@ Determine if the supplied pg_control is for this version of PostgreSQL
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Read the version specific pg_control into a general data structure
|
||||
***********************************************************************************************************************************/
|
||||
|
@ -95,7 +95,7 @@ typedef unsigned int Oid;
|
||||
#endif
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Types from src/include/utils/pg_crc32.h
|
||||
Types from src/include/port/pg_crc32.h
|
||||
***********************************************************************************************************************************/
|
||||
|
||||
// pg_crc32/c type
|
||||
@ -177,9 +177,31 @@ Types from src/include/catalog/catversion.h
|
||||
***********************************************************************************************************************************/
|
||||
|
||||
// CATALOG_VERSION_NO define
|
||||
//
|
||||
// When PostgreSQL is in alpha/beta/rc the catalog version may change with each release. To prevent breakage during this period
|
||||
// define CATATLOG_VERSION_NO_MAX. This will allow the catalog version to "float" through the end of the year. After the PostgreSQL
|
||||
// release, remove CATALOG_VERSION_NO_MAX in the next pgBackRest release to lock down the catalog version. A side effect of this is
|
||||
// that during the period when the catalog number is allowed to float pgBackRest may misidentify development versions of PostgreSQL
|
||||
// for the next release as being an alpha/beta/rc for the current release. This seems a minor issue to prevent breakage.
|
||||
// ---------------------------------------------------------------------------------------------------------------------------------
|
||||
#if PG_VERSION > PG_VERSION_MAX
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_14
|
||||
|
||||
/*
|
||||
* 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 202105121
|
||||
|
||||
// Allow the catalog version to float during the PostgreSQL 14 beta/rc period
|
||||
#define CATALOG_VERSION_NO_MAX
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_13
|
||||
|
||||
/*
|
||||
@ -454,6 +476,44 @@ Types from src/include/catalog/pg_control.h
|
||||
// ---------------------------------------------------------------------------------------------------------------------------------
|
||||
#if PG_VERSION > PG_VERSION_MAX
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_14
|
||||
|
||||
/*
|
||||
* Body of CheckPoint XLOG records. This is declared here because we keep
|
||||
* a copy of the latest one in pg_control for possible disaster recovery.
|
||||
* Changing this struct requires a PG_CONTROL_VERSION bump.
|
||||
*/
|
||||
typedef struct CheckPoint
|
||||
{
|
||||
XLogRecPtr redo; /* next RecPtr available when we began to
|
||||
* create CheckPoint (i.e. REDO start point) */
|
||||
TimeLineID ThisTimeLineID; /* current TLI */
|
||||
TimeLineID PrevTimeLineID; /* previous TLI, if this record begins a new
|
||||
* timeline (equals ThisTimeLineID otherwise) */
|
||||
bool fullPageWrites; /* current full_page_writes */
|
||||
FullTransactionId nextXid; /* next free transaction ID */
|
||||
Oid nextOid; /* next free OID */
|
||||
MultiXactId nextMulti; /* next free MultiXactId */
|
||||
MultiXactOffset nextMultiOffset; /* next free MultiXact offset */
|
||||
TransactionId oldestXid; /* cluster-wide minimum datfrozenxid */
|
||||
Oid oldestXidDB; /* database with minimum datfrozenxid */
|
||||
MultiXactId oldestMulti; /* cluster-wide minimum datminmxid */
|
||||
Oid oldestMultiDB; /* database with minimum datminmxid */
|
||||
pg_time_t time; /* time stamp of checkpoint */
|
||||
TransactionId oldestCommitTsXid; /* oldest Xid with valid commit
|
||||
* timestamp */
|
||||
TransactionId newestCommitTsXid; /* newest Xid with valid commit
|
||||
* timestamp */
|
||||
|
||||
/*
|
||||
* Oldest XID still running. This is only needed to initialize hot standby
|
||||
* mode from an online checkpoint, so we only bother calculating this for
|
||||
* online checkpoints and only when wal_level is replica. Otherwise it's
|
||||
* set to InvalidTransactionId.
|
||||
*/
|
||||
TransactionId oldestActiveXid;
|
||||
} CheckPoint;
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_12
|
||||
|
||||
/*
|
||||
@ -2163,6 +2223,10 @@ Types from src/include/access/xlog_internal.h
|
||||
// ---------------------------------------------------------------------------------------------------------------------------------
|
||||
#if PG_VERSION > PG_VERSION_MAX
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_14
|
||||
|
||||
#define XLOG_PAGE_MAGIC 0xD10D /* can be used as WAL version indicator */
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_13
|
||||
|
||||
#define XLOG_PAGE_MAGIC 0xD106 /* can be used as WAL version indicator */
|
||||
@ -2221,6 +2285,27 @@ Types from src/include/access/xlog_internal.h
|
||||
// ---------------------------------------------------------------------------------------------------------------------------------
|
||||
#if PG_VERSION > PG_VERSION_MAX
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_14
|
||||
|
||||
/*
|
||||
* Each page of XLOG file has a header like this:
|
||||
*/
|
||||
typedef struct XLogPageHeaderData
|
||||
{
|
||||
uint16 xlp_magic; /* magic value for correctness checks */
|
||||
uint16 xlp_info; /* flag bits, see below */
|
||||
TimeLineID xlp_tli; /* TimeLineID of first record on page */
|
||||
XLogRecPtr xlp_pageaddr; /* XLOG address of this page */
|
||||
|
||||
/*
|
||||
* When there is not enough space on current page for whole record, we
|
||||
* continue on the next page. xlp_rem_len is the number of bytes
|
||||
* remaining from a previous page; it tracks xl_tot_len in the initial
|
||||
* header. Note that the continuation data isn't necessarily aligned.
|
||||
*/
|
||||
uint32 xlp_rem_len; /* total len of remaining data for record */
|
||||
} XLogPageHeaderData;
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_93
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user