Re: Bug in pg_get_aios()

From: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
To: cca5507 <cca5507(at)qq(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Bug in pg_get_aios()
Date: 2026-03-23 06:30:28
Message-ID: 32BBB449-13FF-4DC7-9F7E-FB92CA0932FA@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Mar 23, 2026, at 14:23, cca5507 <cca5507(at)qq(dot)com> wrote:
>
> Hi,
>
> If I understand correctly, we want to set nulls[0] to true if owner_pid equals to 0:
>
> ```
> diff --git a/src/backend/storage/aio/aio_funcs.c b/src/backend/storage/aio/aio_funcs.c
> index 8997c762062..bcdd82318f7 100644
> --- a/src/backend/storage/aio/aio_funcs.c
> +++ b/src/backend/storage/aio/aio_funcs.c
> @@ -149,7 +149,7 @@ retry:
> if (owner_pid != 0)
> values[0] = Int32GetDatum(owner_pid);
> else
> - nulls[0] = false;
> + nulls[0] = true;
>
> /* column: IO's id */
> values[1] = Int32GetDatum(ioh_id);
> ```
>
> --
> Regards,
> ChangAo Chen

Indeed an obvious bug.

If we looking downwards, there is a correct usage:
```
/* column: raw result (i.e. some form of syscall return value) */
if (start_state == PGAIO_HS_COMPLETED_IO
|| start_state == PGAIO_HS_COMPLETED_SHARED
|| start_state == PGAIO_HS_COMPLETED_LOCAL)
values[9] = Int32GetDatum(ioh_copy.result);
else
nulls[9] = true;
```

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pierre Ducroquet 2026-03-23 06:33:33 Re: Change default of jit to off
Previous Message Tender Wang 2026-03-23 06:29:58 Fix "could not find memoization table entry"