From 21fcfcb7eb6035ea54b71fe83f50d4132a475fb7 Mon Sep 17 00:00:00 2001 From: David Christensen Date: Wed, 28 Feb 2024 13:15:25 -0500 Subject: [PATCH v4 11/22] Control File support for reserved_page_size --- src/backend/access/transam/xlog.c | 5 ++++- src/bin/pg_controldata/pg_controldata.c | 2 ++ src/include/catalog/pg_control.h | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cfb8e94136..b372e4548d 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -4181,6 +4181,7 @@ WriteControlFile(void) ControlFile->relseg_size = RELSEG_SIZE; ControlFile->xlog_blcksz = XLOG_BLCKSZ; ControlFile->xlog_seg_size = wal_segment_size; + ControlFile->reserved_page_size = ReservedPageSize; ControlFile->nameDataLen = NAMEDATALEN; ControlFile->indexMaxKeys = INDEX_MAX_KEYS; @@ -4250,8 +4251,9 @@ ReadControlFile(void) pg_crc32c crc; int fd; static char wal_segsz_str[20]; + static char reserved_page_size_str[20]; int r; - + int reserved_page_size; /* * Read data... */ @@ -4317,6 +4319,7 @@ ReadControlFile(void) ereport(FATAL, (errmsg("incorrect checksum in control file"))); + reserved_page_size = ControlFile->reserved_page_size; /* * Do compatibility checking immediately. If the database isn't * compatible with the backend executable, we want to abort before we can diff --git a/src/bin/pg_controldata/pg_controldata.c b/src/bin/pg_controldata/pg_controldata.c index 93e0837947..9c6b6adae7 100644 --- a/src/bin/pg_controldata/pg_controldata.c +++ b/src/bin/pg_controldata/pg_controldata.c @@ -304,6 +304,8 @@ main(int argc, char *argv[]) /* we don't print floatFormat since can't say much useful about it */ printf(_("Database block size: %u\n"), ControlFile->blcksz); + printf(_("Reserved page size: %u\n"), + ControlFile->reserved_page_size); printf(_("Blocks per segment of large relation: %u\n"), ControlFile->relseg_size); printf(_("WAL block size: %u\n"), diff --git a/src/include/catalog/pg_control.h b/src/include/catalog/pg_control.h index a00606ffcd..40f6c1e8cd 100644 --- a/src/include/catalog/pg_control.h +++ b/src/include/catalog/pg_control.h @@ -22,7 +22,7 @@ /* Version identifier for this pg_control format */ -#define PG_CONTROL_VERSION 1300 +#define PG_CONTROL_VERSION 1700 /* Nonce key length, see below */ #define MOCK_AUTH_NONCE_LEN 32 @@ -227,6 +227,7 @@ typedef struct ControlFileData */ char mock_authentication_nonce[MOCK_AUTH_NONCE_LEN]; + uint32 reserved_page_size; /* how much space per disk block is reserved */ /* CRC of all above ... MUST BE LAST! */ pg_crc32c crc; } ControlFileData; -- 2.40.1