Re: Using read stream in autoprewarm

From: Melanie Plageman <melanieplageman(at)gmail(dot)com>
To: Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>
Cc: Kirill Reshke <reshkekirill(at)gmail(dot)com>, Matheus Alcantara <mths(dot)dev(at)pm(dot)me>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Using read stream in autoprewarm
Date: 2025-04-01 13:54:47
Message-ID: CAAKRu_ahWvv5-4-VsCk8VY4K9kJ1q76mA4oP5YTYRNrcCHS4kw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Apr 1, 2025 at 7:21 AM Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com> wrote:
>
> On Tue, 1 Apr 2025 at 05:14, Melanie Plageman <melanieplageman(at)gmail(dot)com> wrote:
> >
> +1 for using the functions. I think it is hard to follow / maintain
> this with the do-while loops and goto statements.

I'll take a look at your downthread proposal in a bit.

But the attached patch is a new version of what I proposed with the
functions. It's still not totally correct, but I wanted to see what
you thought.

> > But the explicit looping for skipping the bad blocks and the nested
> > loops for rel and fork -- I think these are less error prone.
>
> One question in my mind is, the outermost loop stops when the database
> changes, we do not check if it is changed from the database oid = 0.
> Handling this might require some structural changes.

I don't understand why each database has global objects at the
beginning. If there are global objects, they are global to all
databases, so surely the sort function would have put them all at the
beginning? One problem is we need a database connection to prewarm
these, but if the global objects are all at the beginning, then maybe
we can handle those with a special case and not force ourselves to
check for them when trying to load blocks from every database.

- Melanie

Attachment Content-Type Size
pgsr-autoprewarm-loopsv2.patch text/x-patch 7.9 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Christoph Berg 2025-04-01 13:54:49 Re: Better HINT message for "unexpected data beyond EOF"
Previous Message vignesh C 2025-04-01 13:52:27 Re: in BeginCopyTo make materialized view using COPY TO instead of COPY (query).