Re: Some read stream improvements

Andres Freund <andres@anarazel.de>

From: Andres Freund <andres@anarazel.de>
To: Thomas Munro <thomas.munro@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-04-07T01:29:53Z
Lists: pgsql-hackers
Hi,

On 2025-04-03 14:43:40 +1300, Thomas Munro wrote:
> On Thu, Apr 3, 2025 at 11:17 AM Andres Freund <andres@anarazel.de> wrote:
> > I don't actually see any reason for buffer_limit to be a 16bit quantity? It's
> > just to clamp things down, right?
> 
> Ugh.  It might be worth just flipping this whole thing over to ints,
> let me look into that...

If you don't mind I'll push the obvious minimal fix soon - it's a confusing
crash when one encounters this issue...

Greetings,

Andres Freund



Commits

  1. read_stream: Fix overflow hazard with large shared buffers

  2. Support buffer forwarding in StartReadBuffers().

  3. Support buffer forwarding in read_stream.c.

  4. Simplify distance heuristics in read_stream.c.

  5. Improve read_stream.c advice for dense streams.

  6. Respect changing pin limits in read_stream.c.

  7. Improve buffer manager API for backend pin limits.

  8. Remove arbitrary cap on read_stream.c buffer queue.