1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-06-27 00:21:08 +02:00

PostgreSQL 13 beta1 support.

There don't appear to be any behavioral changes since PostgreSQL 12 and all the tests pass.

Changes to the control/catalog/WAL versions in subsequent betas may break compatibility but pgBackRest will be updated with each release to keep pace.
This commit is contained in:
David Steele
2020-05-21 13:46:16 -04:00
committed by GitHub
parent ed81432151
commit ec7b7c5a3e
13 changed files with 232 additions and 5 deletions

View File

@ -134,6 +134,16 @@
<p>Add local <proper>MD5</proper> implementation so <proper>S3</proper> works when <proper>FIPS</proper> is enabled.</p>
</release-item>
<release-item>
<release-item-contributor-list>
<release-item-reviewer id="cynthia.shang"/>
</release-item-contributor-list>
<p><postgres/> 13 beta1 support.</p>
<p>Changes to the control/catalog/WAL versions in subsequent betas may break compatibility but <backrest/> will be updated with each release to keep pace.</p>
</release-item>
<release-item>
<release-item-contributor-list>
<release-item-reviewer id="stephen.frost"/>

View File

@ -135,6 +135,7 @@ SRCS = \
postgres/interface/v100.c \
postgres/interface/v110.c \
postgres/interface/v120.c \
postgres/interface/v130.c \
protocol/client.c \
protocol/command.c \
protocol/helper.c \

View File

@ -110,6 +110,23 @@ typedef struct PgInterface
static const PgInterface pgInterface[] =
{
{
.version = PG_VERSION_13,
.catalogVersion = pgInterfaceCatalogVersion130,
.controlIs = pgInterfaceControlIs130,
.control = pgInterfaceControl130,
.controlVersion = pgInterfaceControlVersion130,
.walIs = pgInterfaceWalIs130,
.wal = pgInterfaceWal130,
#ifdef DEBUG
.controlTest = pgInterfaceControlTest130,
.walTest = pgInterfaceWalTest130,
#endif
},
{
.version = PG_VERSION_12,

View File

@ -0,0 +1,12 @@
/***********************************************************************************************************************************
PostgreSQL 13 Interface
See postgres/interface/version.intern.h for documentation.
***********************************************************************************************************************************/
#include "build.auto.h"
#define PG_VERSION PG_VERSION_13
#include "postgres/interface/version.intern.h"
PG_INTERFACE(130);

View File

@ -93,6 +93,13 @@ uint32_t pgInterfaceControlVersion120(void);
bool pgInterfaceWalIs120(const unsigned char *walFile);
PgWal pgInterfaceWal120(const unsigned char *controlFile);
uint32_t pgInterfaceCatalogVersion130(void);
bool pgInterfaceControlIs130(const unsigned char *controlFile);
PgControl pgInterfaceControl130(const unsigned char *controlFile);
uint32_t pgInterfaceControlVersion130(void);
bool pgInterfaceWalIs130(const unsigned char *walFile);
PgWal pgInterfaceWal130(const unsigned char *controlFile);
/***********************************************************************************************************************************
Test Functions
***********************************************************************************************************************************/
@ -132,6 +139,9 @@ Test Functions
void pgInterfaceControlTest120(PgControl pgControl, unsigned char *buffer);
void pgInterfaceWalTest120(PgWal pgWal, unsigned char *buffer);
void pgInterfaceControlTest130(PgControl pgControl, unsigned char *buffer);
void pgInterfaceWalTest130(PgWal pgWal, unsigned char *buffer);
#endif
#endif

View File

@ -180,6 +180,18 @@ Types from src/include/catalog/catversion.h
// ---------------------------------------------------------------------------------------------------------------------------------
#if PG_VERSION > PG_VERSION_MAX
#elif PG_VERSION >= PG_VERSION_13
/*
* 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 202005171
#elif PG_VERSION >= PG_VERSION_12
/*
* We could use anything we wanted for version numbers, but I recommend
@ -367,6 +379,11 @@ Types from src/include/catalog/pg_control.h
// ---------------------------------------------------------------------------------------------------------------------------------
#if PG_VERSION > PG_VERSION_MAX
#elif PG_VERSION >= PG_VERSION_13
/* Version identifier for this pg_control format */
#define PG_CONTROL_VERSION 1300
#elif PG_VERSION >= PG_VERSION_12
/* Version identifier for this pg_control format */
@ -738,6 +755,144 @@ typedef enum DBState
// ---------------------------------------------------------------------------------------------------------------------------------
#if PG_VERSION > PG_VERSION_MAX
#elif PG_VERSION >= PG_VERSION_13
/*
* Contents of pg_control.
*/
typedef struct ControlFileData
{
/*
* Unique system identifier --- to ensure we match up xlog files with the
* installation that produced them.
*/
uint64 system_identifier;
/*
* Version identifier information. Keep these fields at the same offset,
* especially pg_control_version; they won't be real useful if they move
* around. (For historical reasons they must be 8 bytes into the file
* rather than immediately at the front.)
*
* pg_control_version identifies the format of pg_control itself.
* catalog_version_no identifies the format of the system catalogs.
*
* There are additional version identifiers in individual files; for
* example, WAL logs contain per-page magic numbers that can serve as
* version cues for the WAL log.
*/
uint32 pg_control_version; /* PG_CONTROL_VERSION */
uint32 catalog_version_no; /* see catversion.h */
/*
* System status data
*/
DBState state; /* see enum above */
pg_time_t time; /* time stamp of last pg_control update */
XLogRecPtr checkPoint; /* last check point record ptr */
CheckPoint checkPointCopy; /* copy of last check point record */
XLogRecPtr unloggedLSN; /* current fake LSN value, for unlogged rels */
/*
* These two values determine the minimum point we must recover up to
* before starting up:
*
* minRecoveryPoint is updated to the latest replayed LSN whenever we
* flush a data change during archive recovery. That guards against
* starting archive recovery, aborting it, and restarting with an earlier
* stop location. If we've already flushed data changes from WAL record X
* to disk, we mustn't start up until we reach X again. Zero when not
* doing archive recovery.
*
* backupStartPoint is the redo pointer of the backup start checkpoint, if
* we are recovering from an online backup and haven't reached the end of
* backup yet. It is reset to zero when the end of backup is reached, and
* we mustn't start up before that. A boolean would suffice otherwise, but
* we use the redo pointer as a cross-check when we see an end-of-backup
* record, to make sure the end-of-backup record corresponds the base
* backup we're recovering from.
*
* backupEndPoint is the backup end location, if we are recovering from an
* online backup which was taken from the standby and haven't reached the
* end of backup yet. It is initialized to the minimum recovery point in
* pg_control which was backed up last. It is reset to zero when the end
* of backup is reached, and we mustn't start up before that.
*
* If backupEndRequired is true, we know for sure that we're restoring
* from a backup, and must see a backup-end record before we can safely
* start up. If it's false, but backupStartPoint is set, a backup_label
* file was found at startup but it may have been a leftover from a stray
* pg_start_backup() call, not accompanied by pg_stop_backup().
*/
XLogRecPtr minRecoveryPoint;
TimeLineID minRecoveryPointTLI;
XLogRecPtr backupStartPoint;
XLogRecPtr backupEndPoint;
bool backupEndRequired;
/*
* Parameter settings that determine if the WAL can be used for archival
* or hot standby.
*/
int wal_level;
bool wal_log_hints;
int MaxConnections;
int max_worker_processes;
int max_wal_senders;
int max_prepared_xacts;
int max_locks_per_xact;
bool track_commit_timestamp;
/*
* This data is used to check for hardware-architecture compatibility of
* the database and the backend executable. We need not check endianness
* explicitly, since the pg_control version will surely look wrong to a
* machine of different endianness, but we do need to worry about MAXALIGN
* and floating-point format. (Note: storage layout nominally also
* depends on SHORTALIGN and INTALIGN, but in practice these are the same
* on all architectures of interest.)
*
* Testing just one double value is not a very bulletproof test for
* floating-point compatibility, but it will catch most cases.
*/
uint32 maxAlign; /* alignment requirement for tuples */
double floatFormat; /* constant 1234567.0 */
#define FLOATFORMAT_VALUE 1234567.0
/*
* This data is used to make sure that configuration of this database is
* compatible with the backend executable.
*/
uint32 blcksz; /* data block size for this DB */
uint32 relseg_size; /* blocks per segment of large relation */
uint32 xlog_blcksz; /* block size within WAL files */
uint32 xlog_seg_size; /* size of each WAL segment */
uint32 nameDataLen; /* catalog name field width */
uint32 indexMaxKeys; /* max number of columns in an index */
uint32 toast_max_chunk_size; /* chunk size in TOAST tables */
uint32 loblksize; /* chunk size in pg_largeobject */
bool float8ByVal; /* float8, int8, etc pass-by-value? */
/* Are data pages protected by checksums? Zero if no checksum version */
uint32 data_checksum_version;
/*
* Random nonce, used in authentication requests that need to proceed
* based on values that are cluster-unique, like a SASL exchange that
* failed at an early stage.
*/
char mock_authentication_nonce[MOCK_AUTH_NONCE_LEN];
/* CRC of all above ... MUST BE LAST! */
pg_crc32c crc;
} ControlFileData;
#elif PG_VERSION >= PG_VERSION_12
/*
@ -2005,6 +2160,10 @@ Types from src/include/access/xlog_internal.h
// ---------------------------------------------------------------------------------------------------------------------------------
#if PG_VERSION > PG_VERSION_MAX
#elif PG_VERSION >= PG_VERSION_13
#define XLOG_PAGE_MAGIC 0xD106 /* can be used as WAL version indicator */
#elif PG_VERSION >= PG_VERSION_12
#define XLOG_PAGE_MAGIC 0xD101 /* can be used as WAL version indicator */
@ -2076,7 +2235,7 @@ typedef struct XLogPageHeaderData
* continue on the next page. xlp_rem_len is the number of bytes
* remaining from a previous page.
*
* Note that xl_rem_len includes backup-block data; that is, it tracks
* Note that xlp_rem_len includes backup-block data; that is, it tracks
* xl_tot_len not xl_len in the initial header. Also note that the
* continuation data isn't necessarily aligned.
*/

View File

@ -24,8 +24,9 @@ PostgreSQL version constants
#define PG_VERSION_10 100000
#define PG_VERSION_11 110000
#define PG_VERSION_12 120000
#define PG_VERSION_13 130000
#define PG_VERSION_MAX PG_VERSION_12
#define PG_VERSION_MAX PG_VERSION_13
/***********************************************************************************************************************************
Version where various PostgreSQL capabilities were introduced
@ -72,5 +73,6 @@ PostgreSQL version string constants for use in error messages
#define PG_VERSION_10_STR "10"
#define PG_VERSION_11_STR "11"
#define PG_VERSION_12_STR "12"
#define PG_VERSION_13_STR "13"
#endif

View File

@ -12,6 +12,9 @@
# - docker login -u pgbackrest
# - VM=XXX;DATE=YYYYMMDDX;BASE=pgbackrest/test:${VM?}-base;docker tag ${BASE?} ${BASE?}-${DATE?} && docker push ${BASE?}-${DATE?}
# **********************************************************************************************************************************
20200521A:
u18: 7df9a43ce9b6736e5f8dc797edd0f6326908fd2b
20200507A:
f32: 61792779061d2a675509c65bfa64b61b8d4cea17
@ -19,4 +22,3 @@
co6: c07889acc321e461263fada797941cfa947d2550
co7: 538dc7fd9cc129e44d4ae6bacfb6f1db10309993
u12: 8a88ab44aace049d7da5ca1094375ff8b9aeb7ab
u18: 0f88948969b70f300a9134482e43cda7b94cb24d

View File

@ -506,7 +506,7 @@ sub containerBuild
{
$strScript .=
" echo 'deb http://apt.postgresql.org/pub/repos/apt/ " .
$$oVm{$strOS}{&VM_OS_REPO} . '-pgdg main' .
$$oVm{$strOS}{&VM_OS_REPO} . '-pgdg main' . ($strOS eq VM_U18 ? ' 13' : '') .
"' >> /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" .

View File

@ -39,6 +39,8 @@ use constant PG_VERSION_11 => '11';
push @EXPORT, qw(PG_VERSION_11);
use constant PG_VERSION_12 => '12';
push @EXPORT, qw(PG_VERSION_12);
use constant PG_VERSION_13 => '13';
push @EXPORT, qw(PG_VERSION_13);
use constant PG_VERSION_APPLICATION_NAME => PG_VERSION_90;
push @EXPORT, qw(PG_VERSION_APPLICATION_NAME);
@ -58,7 +60,8 @@ sub versionSupport
my ($strOperation) = logDebugParam(__PACKAGE__ . '->versionSupport');
my @strySupportVersion = (PG_VERSION_83, PG_VERSION_84, PG_VERSION_90, PG_VERSION_91, PG_VERSION_92, PG_VERSION_93,
PG_VERSION_94, PG_VERSION_95, PG_VERSION_96, PG_VERSION_10, PG_VERSION_11, PG_VERSION_12);
PG_VERSION_94, PG_VERSION_95, PG_VERSION_96, PG_VERSION_10, PG_VERSION_11, PG_VERSION_12,
PG_VERSION_13);
# Return from function and log return values if any
return logDebugReturn

View File

@ -414,6 +414,7 @@ my $oyVm =
PG_VERSION_10,
PG_VERSION_11,
PG_VERSION_12,
PG_VERSION_13,
],
&VM_DB_TEST =>
@ -421,6 +422,7 @@ my $oyVm =
PG_VERSION_94,
PG_VERSION_11,
PG_VERSION_12,
PG_VERSION_13,
],
},
};

View File

@ -109,6 +109,10 @@ my $oPgControlVersionHash =
{
201909212 => PG_VERSION_12,
},
1300 =>
{
202005171 => PG_VERSION_13,
},
};
sub info

View File

@ -229,6 +229,7 @@ sub dbCatalogVersion
&PG_VERSION_10 => 201707211,
&PG_VERSION_11 => 201806231,
&PG_VERSION_12 => 201909212,
&PG_VERSION_13 => 202005171,
};
if (!defined($hCatalogVersion->{$strPgVersion}))
@ -272,6 +273,7 @@ sub dbControlVersion
&PG_VERSION_10 => 1002,
&PG_VERSION_11 => 1100,
&PG_VERSION_12 => 1201,
&PG_VERSION_13 => 1300,
};
if (!defined($hControlVersion->{$strPgVersion}))
@ -322,6 +324,7 @@ sub controlGenerateContent
'10' => 200 - length($tControlContent),
'11' => 192 - length($tControlContent),
'12' => 196 - length($tControlContent),
'13' => 196 - length($tControlContent),
},
64 =>
@ -338,6 +341,7 @@ sub controlGenerateContent
'10' => 216 - length($tControlContent),
'11' => 208 - length($tControlContent),
'12' => 212 - length($tControlContent),
'13' => 212 - length($tControlContent),
},
};
@ -430,6 +434,7 @@ sub walGenerateContent
&PG_VERSION_10 => hex('0xD097'),
&PG_VERSION_11 => hex('0xD098'),
&PG_VERSION_12 => hex('0xD101'),
&PG_VERSION_13 => hex('0xD106'),
};
my $tWalContent = pack('S', $hWalMagic->{$strPgVersion});