Re: Using read_stream in index vacuum

From: Melanie Plageman <melanieplageman(at)gmail(dot)com>
To: Kirill Reshke <reshkekirill(at)gmail(dot)com>
Cc: "Andrey M(dot) Borodin" <x4mmm(at)yandex-team(dot)ru>, Rahila Syed <rahilasyed90(at)gmail(dot)com>, Junwang Zhao <zhjwpku(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Subject: Re: Using read_stream in index vacuum
Date: 2025-03-18 15:37:33
Message-ID: CAAKRu_aGDmhPfsG=Ocww6K1wdKY8D41M1urE3vc2maZs97daXg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Mar 18, 2025 at 11:12 AM Melanie Plageman
<melanieplageman(at)gmail(dot)com> wrote:
>
> I'm looking at 0001 with the intent of committing it soon. Today I've
> just been studying the test with the injection points.

Now, I've reviewed 0001. I manually validated it does read combining etc.

Few comments:

I know I was the one that advocated calling read_stream_next_buffer()
in the while loop, but I've realized that I think we have to change it
so that we can call vacuum_delay_point() before calling
read_stream_next_buffer(). Otherwise we hold the buffer pin during
vacuum_delay_point(). We'll want to remove it from the top of
btvacuumpage() and add it in this loop:

/* Iterate over pages, then loop back to recheck relation length */
while(BufferIsValid(buf = read_stream_next_buffer(stream, NULL)))
{
BlockNumber current_block = btvacuumpage(&vstate, buf);
if (info->report_progress)
pgstat_progress_update_param(PROGRESS_SCAN_BLOCKS_DONE,
current_block);
}

and before the call to ReadBufferExtended() in the backtrack code path.

buf = ReadBufferExtended(rel, MAIN_FORKNUM, blkno, RBM_NORMAL,
info->strategy);

Also, I think this comment could use a slight update.

/*
* btvacuumpage --- VACUUM one page
*
* This processes a single page for btvacuumscan(). In some cases we must
* backtrack to re-examine and VACUUM pages that were the scanblkno during
*/

scanblkno is a local variable but the comment was written when it was
a parameter. I think it would be more clear to refer to the passed in
"buf" variable instead.

- Melanie

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2025-03-18 15:42:59 Re: Optimization for lower(), upper(), casefold() functions.
Previous Message Daniel Gustafsson 2025-03-18 15:25:37 Re: ecdh support causes unnecessary roundtrips