public inbox for [email protected]  
help / color / mirror / Atom feed
Bug in pg_get_aios()
3+ messages / 3 participants
[nested] [flat]

* Bug in pg_get_aios()
@ 2026-03-23 06:23 =?utf-8?B?Y2NhNTUwNw==?= <[email protected]>
  2026-03-23 08:44 ` Re: Bug in pg_get_aios() Michael Paquier <[email protected]>
  0 siblings, 1 reply; 3+ messages in thread

From: =?utf-8?B?Y2NhNTUwNw==?= @ 2026-03-23 06:23 UTC (permalink / raw)
  To: =?utf-8?B?cGdzcWwtaGFja2Vycw==?= <[email protected]>

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


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Bug in pg_get_aios()
  2026-03-23 06:23 Bug in pg_get_aios() =?utf-8?B?Y2NhNTUwNw==?= <[email protected]>
@ 2026-03-23 08:44 ` Michael Paquier <[email protected]>
  2026-03-23 15:50   ` Re: Bug in pg_get_aios() Andres Freund <[email protected]>
  0 siblings, 1 reply; 3+ messages in thread

From: Michael Paquier @ 2026-03-23 08:44 UTC (permalink / raw)
  To: Chao Li <[email protected]>; +Cc: cca5507 <[email protected]>; pgsql-hackers <[email protected]>

On Mon, Mar 23, 2026 at 02:30:28PM +0800, Chao Li wrote:
>> On Mar 23, 2026, at 14:23, cca5507 <[email protected]> wrote:
>> If I understand correctly, we want to set nulls[0] to true if owner_pid equals to 0:
> 
> Indeed an obvious bug.

Or the intention of the code could have been to allow a PID value of 0
to be exposed, but I don't really buy it.  Will fix, thanks for the
report.
--
Michael


Attachments:

  [application/pgp-signature] signature.asc (833B, 2-signature.asc)
  download

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Bug in pg_get_aios()
  2026-03-23 06:23 Bug in pg_get_aios() =?utf-8?B?Y2NhNTUwNw==?= <[email protected]>
  2026-03-23 08:44 ` Re: Bug in pg_get_aios() Michael Paquier <[email protected]>
@ 2026-03-23 15:50   ` Andres Freund <[email protected]>
  0 siblings, 0 replies; 3+ messages in thread

From: Andres Freund @ 2026-03-23 15:50 UTC (permalink / raw)
  To: [email protected]

Hi, 

On March 23, 2026 4:44:21 AM EDT, Michael Paquier <[email protected]> wrote:
>On Mon, Mar 23, 2026 at 02:30:28PM +0800, Chao Li wrote:
>>> On Mar 23, 2026, at 14:23, cca5507 <[email protected]> wrote:
>>> If I understand correctly, we want to set nulls[0] to true if owner_pid equals to 0:
>> 
>> Indeed an obvious bug.
>
>Or the intention of the code could have been to allow a PID value of 0
>to be exposed, but I don't really buy it.

That certainly wasn't the intent :).

I suspect this is unreachable, we wait for ios before exiting, but of course that doesn't excuse broken code.


>Will fix, thanks for the report.

Thanks! 

Andres


-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2026-03-23 15:50 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-03-23 06:23 Bug in pg_get_aios() =?utf-8?B?Y2NhNTUwNw==?= <[email protected]>
2026-03-23 08:44 ` Michael Paquier <[email protected]>
2026-03-23 15:50   ` Andres Freund <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox