Re: Non-reproducible AIO failure

From: Konstantin Knizhnik <knizhnik(at)garret(dot)ru>
To: Dmitry Mityugov <dmitry(dot)mityugov(at)gmail(dot)com>
Cc: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Nico Williams <nico(at)cryptonector(dot)com>, Alexander Lakhin <exclusion(at)gmail(dot)com>, Daniel Gustafsson <daniel(at)yesql(dot)se>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, rmt(at)lists(dot)postgresql(dot)org
Subject: Re: Non-reproducible AIO failure
Date: 2025-09-03 18:50:42
Message-ID: bad72acd-fac7-4444-b81c-ed4c9b62505f@garret.ru
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 03/09/2025 8:37 PM, Dmitry Mityugov wrote:
> Quite inspiring discussion. The patch is brilliantly good but it adds
> a bunch of explicit type casts, and it's not always easy to remember
> what cast to use in a particular case, and that may eventually lead to
> errors in the future. Just wanted to add that when 64-bit code is
> generated, uint8s are probably aligned to 64-bit boundaries for
> structures that contain other 64-bit members like pointers, and bit
> fields are not (and they may not have an address at all). To align bit
> fields properly, anonymous bit fields probably can be used, or unions
> containing the bitfields together with uint8s, to avoid the explicit
> casts, like in this example:
>
> struct Foo {
>     union {
>         char a:8;
>         char aa;
>     };
>     char b:8;
>     int* c;
> };
>
> Regards,
>

Size of PgAioHandle is144 bytes. I wonder how critical for us is to save
9 bytes for it (3 bytes vs 3 integers)?
Why not to use normal enums instead of bitfields and uint8 with type casts?

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2025-09-03 19:01:14 Re: Improve LWLock tranche name visibility across backends
Previous Message Jeff Davis 2025-09-03 18:50:05 Re: Should io_method=worker remain the default?