Re: Non-reproducible AIO failure

Thomas Munro <thomas.munro@gmail.com>

From: Thomas Munro <thomas.munro@gmail.com>
To: Nico Williams <nico@cryptonector.com>
Cc: Konstantin Knizhnik <knizhnik@garret.ru>, Alexander Lakhin <exclusion@gmail.com>, Andres Freund <andres@anarazel.de>, Daniel Gustafsson <daniel@yesql.se>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, rmt@lists.postgresql.org
Date: 2025-08-25T02:42:35Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. aio: Stop using enum bitfields due to bad code generation

  2. amcheck: Fix posting tree checks in gin_index_check()

  3. aio: Add missing memory barrier when waiting for IO handle

On Mon, Aug 25, 2025 at 2:41 PM Thomas Munro <thomas.munro@gmail.com> wrote:
> On Mon, Aug 25, 2025 at 1:52 PM Thomas Munro <thomas.munro@gmail.com> wrote:
> > >         struct { PgAioHandleState v:8; } state;
> >
> > This preserves type safety and compiles to strb two properties we
> > want, but it seems to waste space (look at the offsets for the
> > stores):
> >
> > a.out[0x1000005f8] <+140>: ldr    x8, [sp, #0x8]
> > a.out[0x1000005fc] <+144>: strb   wzr, [x8, #0x8]
> > a.out[0x100000600] <+148>: ldr    x8, [sp, #0x8]
> > a.out[0x100000604] <+152>: strb   wzr, [x8, #0x4]
>
> Sorry, I didn't make that very clear: that's open source clang 17
> compiling assignment of zero to two neighbouring wrapped bitfields
> with your trick.  Probably easier to look at the struct layout with
> pahole or printf offsetof(...) or sizeof() to see that PgAioHandle
> grows by 9 bytes of padding, something Andres obviously felt pretty
> strongly about if he felt the need to summon bitfields...

(Errm, surely more than 9 due to alignment of the following stuff, I
was just looking at a truncated test struct with only those bits...)