Re: Trying out read streams in pgvector (an extension)

From: Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Cc: Melanie Plageman <melanieplageman(at)gmail(dot)com>, "Jonathan S(dot) Katz" <jkatz(at)postgresql(dot)org>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Trying out read streams in pgvector (an extension)
Date: 2025-11-12 08:04:28
Message-ID: CAN55FZ16TEhgYbK=qSEbkO8utz+u232NksCEmJMC1G4iZvnbvA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Thank you for working on this!

On Wed, 12 Nov 2025 at 07:12, Thomas Munro <thomas(dot)munro(at)gmail(dot)com> wrote:
>
> On Wed, Nov 12, 2025 at 12:19 PM Thomas Munro <thomas(dot)munro(at)gmail(dot)com> wrote:
> > On Wed, Nov 12, 2025 at 11:52 AM Melanie Plageman
> > <melanieplageman(at)gmail(dot)com> wrote:
> > > If we are worried about regressing other extensions using
> > > read_stream_reset(), we could make the read stream reset which
> > > preserves the distance a different function in backbranches.
>
> Here is a draft patch like that, that tries to be as small as
> possible. Trying out the name read_stream_resume().

I liked the idea of having a different function named
read_stream_resume for this purpose.

0001 looks good to me.

0002:

+ /* End-of-stream. */
+ buf = read_stream_next_buffer(stream, NULL);
+ Assert(buf == InvalidBuffer);
+ buf = read_stream_next_buffer(stream, NULL);
+ Assert(buf == InvalidBuffer);

I noticed there are two 'read_stream_next_buffer()' and
'InvalidBuffer' checks. Does having both provide any additional
validation? I tried removing one of them, and the test still passed.

Also, there is one thing I wanted to clarify about the
'read_stream_resume()'. If 'read_stream_next_buffer()' returns an
'InvalidBuffer', then we can use 'read_stream_resume()' alone because
we know that we already consumed all buffers in the stream. For the
rest, we need to use 'read_stream_resume()' together with the
'read_stream_reset()', right?

--
Regards,
Nazir Bilal Yavuz
Microsoft

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2025-11-12 08:13:09 Re: BUG #19095: Test if function exit() is used fail when linked static
Previous Message Chao Li 2025-11-12 08:00:19 backend/nodes cleanup: Move loop variables definitions into for statement