Re: Beautify read stream "per buffer data" APIs

From: Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Melanie Plageman <melanieplageman(at)gmail(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Subject: Re: Beautify read stream "per buffer data" APIs
Date: 2026-03-27 12:02:03
Message-ID: CAN55FZ1xBV0yFBPRKbRPyVWSSG88emYi81fyUgPqkBhX4oyJ+A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

The discussion of this $subject is actually started in the 'Confine
vacuum skip logic to lazy_scan_skip' [1] thread and it already has a
commitfest entry [2]. I wanted to create seperate thread to make
discussion easier.

Latest patches need rebase, so I took patches in the [3]; rebased them
on top of the current master. Also there were new read_stream_* calls
so I updated them too.

0001 LGTM and one comment about 0002:

The read_stream_put_value() macro doesn't accept literal constant
values, we need to pass a variable to it. Otherwise, the compilation
fails with:

```
../../postgres/src/include/storage/read_stream.h:169:36: error: lvalue
required as unary ‘&’ operand
169 | memcpy((per_buffer_data), &(value), sizeof(value)))
| ^
../../postgres/src/backend/access/heap/vacuumlazy.c:1703:17: note: in
expansion of macro ‘read_stream_put_value’
1703 | read_stream_put_value(stream, per_buffer_data, false);
```

If that is not intentional, I think it would be better if we can
convert read_stream_put_value() to a way that it accepts rvalues.

[1] https://postgr.es/m/CA%2BhUKG%2BSWMtu9D1eevnbdzf%3DvurfuDjdFVM5WnX28Fxp-H3mYg%40mail.gmail.com
[2] https://commitfest.postgresql.org/patch/5617/
[3] https://postgr.es/m/CA%2BhUKGLa7ba7USyT%2BJR7uRiawWeCVJ96wyRsoEXk7r2gngPv%3DA%40mail.gmail.com

--
Regards,
Nazir Bilal Yavuz
Microsoft

Attachment Content-Type Size
v3-0001-Improve-API-for-retrieving-data-from-read-streams.patch text/x-patch 18.9 KB
v3-0002-Improve-API-for-storing-data-in-read-streams.patch text/x-patch 4.5 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2026-03-27 12:15:29 Re: Enable -Wstrict-prototypes and -Wold-style-definition by default
Previous Message Peter Eisentraut 2026-03-27 11:58:13 Re: [Proposal] Generate pkg-config for server module development