1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2026-10-23 21:28:56 +03:00

PostgreSQL 19beta4 support.

Beta4 reverted online data checksum transitions, which removed the in-progress checksum states and the checkpoint checksum state and bumped PG_CONTROL_VERSION:

https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=c05d5ce12366f1008e95b09a0a9b08a49818b0e1

A follow-up to the revert bumped XLOG_PAGE_MAGIC:

https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=4a9a6c5a69c45ba74c694ccb1ff5921dd09a6676

Beta4 also added data_checksum_version_init to pg_control:

https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=aaf8b9989f7aaeb6594122caee1eea6c87e10655

The page checksum version in pg_control is again limited to 0 and 1, so check it against PG_DATA_CHECKSUM_VERSION for all versions and remove the handling of the in-progress states added for PostgreSQL 19.
This commit is contained in:
David Steele
2026-09-27 12:11:20 +03:00
parent 95a14644f3
commit 3c821e6ba2
6 changed files with 25 additions and 34 deletions

View File

@@ -84,6 +84,14 @@
</release-bug-list>
<release-feature-list>
<release-item>
<release-item-contributor-list>
<release-item-contributor id="david.steele"/>
</release-item-contributor-list>
<p><proper>PostgreSQL 19beta4</proper> support.</p>
</release-item>
<release-item>
<github-issue id="2687"/>
<github-pull-request id="2833"/>

View File

@@ -318,18 +318,12 @@ pgControlFromBuffer(const Buffer *const controlFile, const String *const pgVersi
pgPageSizeCheck(result.pageSize);
// Check the checksum version
if ((result.version <= PG_VERSION_18 && result.pageChecksumVersion > PG_DATA_CHECKSUM_VERSION) ||
(result.version > PG_VERSION_18 && result.pageChecksumVersion > PG_DATA_CHECKSUM_INPROGRESS_ON))
if (result.pageChecksumVersion > PG_DATA_CHECKSUM_VERSION)
{
THROW_FMT(
FormatError, "page checksum version is %u but must be <= %d", result.pageChecksumVersion,
result.version <= PG_VERSION_18 ? PG_DATA_CHECKSUM_VERSION : PG_DATA_CHECKSUM_INPROGRESS_ON);
FormatError, "page checksum version is %u but must be <= %d", result.pageChecksumVersion, PG_DATA_CHECKSUM_VERSION);
}
// Clear checksum version values that represent clusters with incomplete checksums
if (result.version > PG_VERSION_18 && result.pageChecksumVersion > PG_DATA_CHECKSUM_VERSION)
result.pageChecksumVersion = 0;
FUNCTION_LOG_RETURN(PG_CONTROL, result);
}

View File

@@ -62,19 +62,14 @@ Types from src/include/storage/checksum.h
// ChecksumStateType enum
// ---------------------------------------------------------------------------------------------------------------------------------
/*
* Checksum state 0 is used for when data checksums are disabled (OFF).
* PG_DATA_CHECKSUM_INPROGRESS_{ON|OFF} defines that data checksums are either
* currently being enabled or disabled, and PG_DATA_CHECKSUM_VERSION defines
* that data checksums are enabled. The ChecksumStateType is stored in
* pg_control so changing requires a catversion bump, and the values cannot
* be reordered. New states must be added at the end.
* Checksum state 0 is used for when data checksums are disabled (OFF), and
* PG_DATA_CHECKSUM_VERSION defines that data checksums are enabled. New
* states must be added at the end.
*/
typedef enum ChecksumStateType
{
PG_DATA_CHECKSUM_OFF = 0,
PG_DATA_CHECKSUM_VERSION = 1,
PG_DATA_CHECKSUM_INPROGRESS_OFF = 2,
PG_DATA_CHECKSUM_INPROGRESS_ON = 3,
} ChecksumStateType;
/***********************************************************************************************************************************

View File

@@ -296,7 +296,7 @@ Types from src/include/catalog/pg_control.h
#elif PG_VERSION >= PG_VERSION_19
/* Version identifier for this pg_control format */
#define PG_CONTROL_VERSION 1902
#define PG_CONTROL_VERSION 1905
#elif PG_VERSION >= PG_VERSION_18
@@ -388,9 +388,6 @@ typedef struct CheckPoint
* set to InvalidTransactionId.
*/
TransactionId oldestActiveXid;
/* data checksums state at the time of the checkpoint */
uint32 dataChecksumState;
} CheckPoint;
#elif PG_VERSION >= PG_VERSION_17
@@ -694,7 +691,13 @@ typedef struct ControlFileData
bool float8ByVal; /* float8, int8, etc pass-by-value? */
/* Are data pages protected by checksums? Zero if no checksum version */
/*
* Data checksum state at cluster initialization. Since the state can be
* changed during runtime, we need to store the initial value for system
* functions which report initdb settings.
*/
uint32 data_checksum_version_init;
/* Current data checksums state */
uint32 data_checksum_version;
/*
@@ -1701,7 +1704,7 @@ Types from src/include/access/xlog_internal.h
#elif PG_VERSION >= PG_VERSION_19
#define XLOG_PAGE_MAGIC 0xD121 /* can be used as WAL version indicator */
#define XLOG_PAGE_MAGIC 0xD122 /* can be used as WAL version indicator */
#elif PG_VERSION >= PG_VERSION_18

View File

@@ -199,6 +199,6 @@ vm:
revision:
all: 20260710A
# Bump for PostgreSQL 19beta3
u24-x86_64: 20260817A
u24-aarch64: 20260817A
# Bump for PostgreSQL 19beta4
u24-x86_64: 20260927A
u24-aarch64: 20260927A

View File

@@ -161,15 +161,6 @@ testRun(void)
TEST_ERROR(
pgControlFromFile(storageTest, NULL), FormatError, "page checksum version is 2 but must be <= 1");
HRN_PG_CONTROL_PUT(storageTest, PG_VERSION_19, .pageChecksumVersion = 4);
TEST_ERROR(
pgControlFromFile(storageTest, NULL), FormatError, "page checksum version is 4 but must be <= 3");
HRN_PG_CONTROL_PUT(storageTest, PG_VERSION_19, .pageChecksumVersion = 3);
TEST_RESULT_UINT(pgControlFromFile(storageTest, NULL).pageChecksumVersion, 0, "incomplete checksums cleared");
// -------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("check all valid page sizes");