Re: Beautify read stream "per buffer data" APIs - Mailing list pgsql-hackers

From Nazir Bilal Yavuz
Subject Re: Beautify read stream "per buffer data" APIs
Date
Msg-id CAN55FZ1xBV0yFBPRKbRPyVWSSG88emYi81fyUgPqkBhX4oyJ+A@mail.gmail.com
Whole thread
Responses Re: Beautify read stream "per buffer data" APIs
List 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

pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: [Proposal] Generate pkg-config for server module development
Next
From: Peter Eisentraut
Date:
Subject: Re: Enable -Wstrict-prototypes and -Wold-style-definition by default