From 286fcaaa2e7cde9f1aad84ab2aa29be2d88f1fb0 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Wed, 16 Sep 2026 09:21:56 +0200 Subject: [PATCH v3 1/5] Rename PGAlignedXLogBlock to PGIOAlignedXLogBlock Before commit faeedbcefd4, PGAlignedXLogBlock was MAXALIGNed and a sibling of PGAlignedBlock. That commit introduced PGIOAlignedBlock that was aligned as PG_IO_ALIGN_SIZE and *changed* PGAlignedXLogBlock to also be aligned as PG_IO_ALIGN_SIZE. This creates an inconsistent naming, as there would now be no room for a MAXALIGNed block of size XLOG_BLCKSZ. To improve this, rename PGAlignedXLogBlock to PGIOAlignedXLogBlock, which now correctly reflects its purpose. A MAXALIGNed PGAlignedXLogBlock could be re-introduced later. --- src/backend/access/transam/xlog.c | 4 ++-- src/bin/pg_basebackup/walmethods.c | 2 +- src/bin/pg_resetwal/pg_resetwal.c | 2 +- src/bin/pg_test_fsync/pg_test_fsync.c | 2 +- src/bin/pg_waldump/pg_waldump.c | 2 +- src/include/c.h | 6 +++--- src/tools/pgindent/typedefs.list | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 9ec0be77ca0..2e7058c9810 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -3533,7 +3533,7 @@ XLogFileCopy(TimeLineID destTLI, XLogSegNo destsegno, { char path[MAXPGPATH]; char tmppath[MAXPGPATH]; - PGAlignedXLogBlock buffer; + PGIOAlignedXLogBlock buffer; int srcfd; int fd; int nbytes; @@ -5677,7 +5677,7 @@ void BootStrapXLOG(uint32 data_checksum_version) { CheckPoint checkPoint; - PGAlignedXLogBlock buffer; + PGIOAlignedXLogBlock buffer; XLogPageHeader page; XLogLongPageHeader longpage; XLogRecord *record; diff --git a/src/bin/pg_basebackup/walmethods.c b/src/bin/pg_basebackup/walmethods.c index 3a6b3b5f45b..44cacaf97ea 100644 --- a/src/bin/pg_basebackup/walmethods.c +++ b/src/bin/pg_basebackup/walmethods.c @@ -804,7 +804,7 @@ tar_write(Walfile *f, const void *buf, size_t count) static bool tar_write_padding_data(TarMethodFile *f, size_t bytes) { - PGAlignedXLogBlock zerobuf; + PGIOAlignedXLogBlock zerobuf; size_t bytesleft = bytes; memset(zerobuf.data, 0, XLOG_BLCKSZ); diff --git a/src/bin/pg_resetwal/pg_resetwal.c b/src/bin/pg_resetwal/pg_resetwal.c index 41afc4c1316..ddaa23ac135 100644 --- a/src/bin/pg_resetwal/pg_resetwal.c +++ b/src/bin/pg_resetwal/pg_resetwal.c @@ -1137,7 +1137,7 @@ KillExistingWALSummaries(void) static void WriteEmptyXLOG(void) { - PGAlignedXLogBlock buffer; + PGIOAlignedXLogBlock buffer; XLogPageHeader page; XLogLongPageHeader longpage; XLogRecord *record; diff --git a/src/bin/pg_test_fsync/pg_test_fsync.c b/src/bin/pg_test_fsync/pg_test_fsync.c index c51b1271f1f..b59799cde31 100644 --- a/src/bin/pg_test_fsync/pg_test_fsync.c +++ b/src/bin/pg_test_fsync/pg_test_fsync.c @@ -68,7 +68,7 @@ static const char *progname; static unsigned int secs_per_test = 5; static int needs_unlink = 0; -alignas(PGAlignedXLogBlock) static char buf[DEFAULT_XLOG_SEG_SIZE]; +alignas(PGIOAlignedXLogBlock) static char buf[DEFAULT_XLOG_SEG_SIZE]; static char *filename = FSYNC_FILENAME; static struct timeval start_t, stop_t; diff --git a/src/bin/pg_waldump/pg_waldump.c b/src/bin/pg_waldump/pg_waldump.c index 6f0574a8764..908a2080411 100644 --- a/src/bin/pg_waldump/pg_waldump.c +++ b/src/bin/pg_waldump/pg_waldump.c @@ -236,7 +236,7 @@ search_directory(const char *directory, const char *fname, int *WalSegSz) /* set WalSegSz if file is successfully opened */ if (fd >= 0) { - PGAlignedXLogBlock buf; + PGIOAlignedXLogBlock buf; ssize_t r; r = read(fd, buf.data, XLOG_BLCKSZ); diff --git a/src/include/c.h b/src/include/c.h index 20cfbac54e7..83d54a0bf65 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -1269,16 +1269,16 @@ typedef struct PGIOAlignedBlock } PGIOAlignedBlock; /* Same, but for an XLOG_BLCKSZ-sized buffer */ -typedef struct PGAlignedXLogBlock +typedef struct PGIOAlignedXLogBlock { alignas(PG_IO_ALIGN_SIZE) char data[XLOG_BLCKSZ]; -} PGAlignedXLogBlock; +} PGIOAlignedXLogBlock; #else /* (g++ < 9) */ /* Allow these types to be used as abstract types when using old g++ */ typedef struct PGIOAlignedBlock PGIOAlignedBlock; -typedef struct PGAlignedXLogBlock PGAlignedXLogBlock; +typedef struct PGIOAlignedXLogBlock PGIOAlignedXLogBlock; #endif /* !(g++ < 9) */ diff --git a/src/tools/pgindent/typedefs.list b/src/tools/pgindent/typedefs.list index 0dc817cc2b8..871849e0c34 100644 --- a/src/tools/pgindent/typedefs.list +++ b/src/tools/pgindent/typedefs.list @@ -1912,7 +1912,6 @@ PERL_CONTEXT PERL_SI PFN PGAlignedBlock -PGAlignedXLogBlock PGAsyncStatusType PGCALL2 PGCRYPTO_SHA_t @@ -1931,6 +1930,7 @@ PGFInfoFunction PGFileType PGFunction PGIOAlignedBlock +PGIOAlignedXLogBlock PGLZ_HistEntry PGLZ_Strategy PGLoadBalanceType base-commit: 884f82ae2621cc8d983bb745ce6c8c1c9a971764 -- 2.55.0