Re: Using read stream in autoprewarm - Mailing list pgsql-hackers

From Daniel Gustafsson
Subject Re: Using read stream in autoprewarm
Date
Msg-id F9ACE8D0-B807-4A17-B6BD-87EF0717983D@yesql.se
Whole thread Raw
In response to Re: Using read stream in autoprewarm  (Melanie Plageman <melanieplageman@gmail.com>)
Responses Re: Using read stream in autoprewarm
List pgsql-hackers
> On 3 Apr 2025, at 21:25, Melanie Plageman <melanieplageman@gmail.com> wrote:
>
> On Thu, Apr 3, 2025 at 11:17 AM Heikki Linnakangas <hlinnaka@iki.fi> wrote:
>>
>> I had a quick look at this. Looks good overall

Same here, this seemed like a good piece to bite into with my limited AIO
knowledge to learn more, and reading it over it seems like a good change.

A few small comments:

+    * `pos` is the read stream callback's index into block_info. Because the
I'm not a fan of markdown in code comments (also in a few more places).


+                       /* Time to try and open our new found relation */
s/new found/newfound/


+   while (p->pos < apw_state->prewarm_stop_idx)
+   {
+       BlockInfoRecord blk = p->block_info[p->pos];
+
+       CHECK_FOR_INTERRUPTS();
Isn't checking inside this loop increasing the frequency of checks compared to
the current version?


+           Assert(read_stream_next_buffer(stream, NULL) == InvalidBuffer);
Is there a non programmer-error case where this can happen?  The Assert right
after a loop around the same function seems to imply there is a race or toctou
case which if so could use a comment.

--
Daniel Gustafsson




pgsql-hackers by date:

Previous
From: Matheus Alcantara
Date:
Subject: Re: why there is not VACUUM FULL CONCURRENTLY?
Next
From: Sami Imseih
Date:
Subject: Re: New criteria for autovacuum