missing PG_IO_ALIGN_SIZE uses

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: missing PG_IO_ALIGN_SIZE uses
Date: 2025-12-01 07:55:50
Message-ID: f462a175-b608-44a1-b428-bdf351e914f4@eisentraut.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Commit faeedbcefd4 changed the alignment of WAL buffers from XLOG_BLCKSZ
to PG_IO_ALIGN_SIZE.

While looking around for places to apply alignas, I think I found at
least two places that were forgotten, namely in BootStrapXLOG() and in
pg_test_fsync.c. Patches attached for those.

I also suspect that the TYPEALIGN call in XLOGShmemInit() should take
PG_IO_ALIGN_SIZE into account, but it's not immediately obvious how,
since the comment also mentions that it wants alignment on "a full xlog
block size boundary". Maybe Max(XLOG_BLCKSZ, PG_IO_ALIGN_SIZE)?

I also wonder whether the check in check_debug_io_direct() for #if
XLOG_BLCKSZ < PG_IO_ALIGN_SIZE would be required if we fixed all those
places?

Attachment Content-Type Size
0001-Use-PG_IO_ALIGN_SIZE-for-aligning-WAL-buffers.patch text/plain 1.6 KB
0002-Use-PGAlignedXLogBlock-in-BootStrapXLOG.patch text/plain 1.9 KB
0003-pg_test_fsync-Align-test-data-using-PGAlignedXLogBlo.patch text/plain 1.6 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Richard Guo 2025-12-01 08:11:25 Re: Some optimizations for COALESCE expressions during constant folding
Previous Message Michael Paquier 2025-12-01 07:24:08 Re: Move WAL/RMGR sequence code into its own file and header