Re: Confine vacuum skip logic to lazy_scan_skip - Mailing list pgsql-hackers

From Thomas Munro
Subject Re: Confine vacuum skip logic to lazy_scan_skip
Date
Msg-id CA+hUKG+SWMtu9D1eevnbdzf=vurfuDjdFVM5WnX28Fxp-H3mYg@mail.gmail.com
Whole thread Raw
In response to Re: Confine vacuum skip logic to lazy_scan_skip  (Melanie Plageman <melanieplageman@gmail.com>)
Responses Re: Confine vacuum skip logic to lazy_scan_skip
List pgsql-hackers
On Fri, Feb 28, 2025 at 11:58 AM Melanie Plageman
<melanieplageman@gmail.com> wrote:
> On Thu, Feb 27, 2025 at 1:08 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> > I wonder if it'd be a good idea to add something like
> >
> >                 Assert(stream->distance == 1);
> >                 Assert(stream->pending_read_nblocks == 0);
> >                 Assert(stream->per_buffer_data_size == 0);
> > +               Assert(per_buffer_data == NULL);
> >
> > in read_stream_next_buffer.  I doubt that this will shut Coverity
> > up, but it would help to catch caller coding errors, i.e. passing
> > a per_buffer_data pointer when there's no per-buffer data.
>
> I think this is a good stopgap. I was discussing adding this assert
> off-list with Thomas and he wanted to detail his more ambitious plans
> for type safety improvements in the read stream API. Less on the order
> of a redesign and more like a separate read_stream_next_buffer()s for
> when there is per buffer data and when there isn't. And a by-value and
> by-reference version for the one where there is data.

Here's what I had in mind.  Is it better?

Attachment

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Small memory fixes for pg_createsubcriber
Next
From: Zhang Mingli
Date:
Subject: Re: Improve documentation regarding custom settings, placeholders, and the administrative functions