Re: Using read stream in autoprewarm

Поиск
Список
Период
Сортировка
От Melanie Plageman
Тема Re: Using read stream in autoprewarm
Дата
Msg-id CAAKRu_azg26XEQkwH_ZEhjy70JSSi1JvvxLjC2f6R73eX9tj8Q@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Using read stream in autoprewarm  (Nazir Bilal Yavuz <byavuz81@gmail.com>)
Ответы Re: Using read stream in autoprewarm
Список pgsql-hackers
On Mon, Mar 31, 2025 at 12:27 PM Nazir Bilal Yavuz <byavuz81@gmail.com> wrote:
>
> I worked on an alternative approach, I refactored code a bit. It does
> not traverse the list two times and I think the code is more suitable
> to use read streams now. I simply get how many blocks are processed by
> read streams and move the list forward by this number, so the actual
> loop skips these blocks. This approach is attached with 'alternative'
> prefix.

I am leaning toward the refactored approach because I don't think we
want to go through the array twice and I think it is hard to get it
right with incrementing p.pos in both places and being sure we
correctly close the relation etc.

Looking at your alternative approach, I don't see how the innermost
while loop in autoprewarm_database_main() is correct

        /* Check whether blocknum is valid and within fork file size. */
        while (cur_filenumber == blk->filenumber &&
               blk->blocknum >= nblocks_in_fork)
        {
            /* Move to next forknum. */
            pos++;
            continue;
        }

Won't this just infinitely loop?

- Melanie



В списке pgsql-hackers по дате отправления: