From 89eae839d5ca79591aaea8157f437688c3b53df4 Mon Sep 17 00:00:00 2001 From: David Steele Date: Sun, 27 Sep 2026 12:26:46 +0300 Subject: [PATCH] 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. --- doc/xml/release/2020s/2026/2.59.2.xml | 10 ++++++++++ src/postgres/interface.c | 10 ++-------- src/postgres/interface/static.vendor.h | 11 +++-------- src/postgres/interface/version.vendor.h | 15 +++++++++------ test/container.yaml | 6 +++--- test/src/module/postgres/interfaceTest.c | 9 --------- 6 files changed, 27 insertions(+), 34 deletions(-) diff --git a/doc/xml/release/2020s/2026/2.59.2.xml b/doc/xml/release/2020s/2026/2.59.2.xml index e3fd8d397..66b6c41c4 100644 --- a/doc/xml/release/2020s/2026/2.59.2.xml +++ b/doc/xml/release/2020s/2026/2.59.2.xml @@ -78,5 +78,15 @@

Fix annotate command on a remote encrypted repository.

+ + + + + + + +

PostgreSQL 19beta4 support.

+
+
diff --git a/src/postgres/interface.c b/src/postgres/interface.c index a2852fc82..1852f546f 100644 --- a/src/postgres/interface.c +++ b/src/postgres/interface.c @@ -322,18 +322,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); } diff --git a/src/postgres/interface/static.vendor.h b/src/postgres/interface/static.vendor.h index 980e2e855..1112e5479 100644 --- a/src/postgres/interface/static.vendor.h +++ b/src/postgres/interface/static.vendor.h @@ -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; /*********************************************************************************************************************************** diff --git a/src/postgres/interface/version.vendor.h b/src/postgres/interface/version.vendor.h index c96259321..c8a9863d3 100644 --- a/src/postgres/interface/version.vendor.h +++ b/src/postgres/interface/version.vendor.h @@ -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 diff --git a/test/container.yaml b/test/container.yaml index cb7d6876e..acb0616a3 100644 --- a/test/container.yaml +++ b/test/container.yaml @@ -28,6 +28,6 @@ # ********************************************************************************************************************************** all: 20260710A -# Bump for PostgreSQL 19beta3 -u22-x86_64: 20260817A -u22-aarch64: 20260817A +# Bump for PostgreSQL 19beta4 +u22-x86_64: 20260927A +u22-aarch64: 20260927A diff --git a/test/src/module/postgres/interfaceTest.c b/test/src/module/postgres/interfaceTest.c index c300de674..f25a5c779 100644 --- a/test/src/module/postgres/interfaceTest.c +++ b/test/src/module/postgres/interfaceTest.c @@ -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");