Re: missing PG_IO_ALIGN_SIZE uses

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: missing PG_IO_ALIGN_SIZE uses
Date: 2025-12-08 14:23:06
Message-ID: cbc3cfff-3dd0-4649-a14f-93fd5bf873e6@eisentraut.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
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.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2025-12-08 14:51:06 Re: Make copyObject work in C++
Previous Message Pavel Stehule 2025-12-08 13:57:51 Re: proposal: schema variables