Re: missing PG_IO_ALIGN_SIZE uses
Peter Eisentraut <peter@eisentraut.org>
From: Peter Eisentraut <peter@eisentraut.org>
To: Chao Li <li.evan.chao@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-12-08T14:23:06Z
Lists: pgsql-hackers
On 02.12.25 02:11, Chao Li wrote: >> <0001-Use-PG_IO_ALIGN_SIZE-for-aligning-WAL-buffers.patch><0002-Use-PGAlignedXLogBlock-in-BootStrapXLOG.patch><0003-pg_test_fsync-Align-test-data-using-PGAlignedXLogBlo.patch> > Overall the patch looks good to me: I have committed these all as one patch. Initially I thought the first patch might be worth backpatching, but it seems that's not needed. > 0001 fixes two overlooked alignment to PG_IO_ALIGN_SIZE > 0002 switches BootStrapXLOG to use PGAlignedXLogBlock, which is aligned to PG_IO_ALIGN_SIZE > 0003 does the same for pg_test_fsync > > My only nit comment is in 0002: > ``` > - memset(page, 0, XLOG_BLCKSZ); > + memset(&buffer, 0, sizeof buffer); > ``` > > I know “sizeof” is an operator instead of a function, “sizeof buffer” is grammatically correct. However, most of places do “sizeof(buffer)”, so unless we want to prompt the syntax of “sizeof buffer” (without the braces), it’s better to keep a consistent syntax. The style without parentheses is not non-existent in PostgreSQL code, so I think we can use it when appropriate.
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Use PGAlignedXLogBlock for some code simplification
- 804046b39a27 19 (unreleased) landed
-
Introduce PG_IO_ALIGN_SIZE and align all I/O buffers.
- faeedbcefd40 16.0 cited