Re: Using read stream in autoprewarm

Поиск
Список
Период
Сортировка
От Matheus Alcantara
Тема Re: Using read stream in autoprewarm
Дата
Msg-id 8a0f6b95-5c37-47ff-94f9-4ff19f161168@gmail.com
обсуждение исходный текст
Ответ на Using read stream in autoprewarm  (Nazir Bilal Yavuz <byavuz81@gmail.com>)
Список pgsql-hackers
On Wednesday, November 27th, 2024 at 11:19 AM, Nazir Bilal Yavuz 
<byavuz81@gmail.com> wrote:
 > > v2-0001-Use-read-stream-in-autoprewarm.patch
 > > + bool *rs_have_free_buffer = per_buffer_data;
 > > +
 > > +
 > > + *rs_have_free_buffer = true;
 > > +
 > >
 > > Not sure if I understand why this variable is needed, it seems that 
it is only
 > > written and never read? Just as comparison, the 
block_range_read_stream_cb
 > > callback used on pg_prewarm seems to not use the per_buffer_data 
parameter.
 >
 >
 > Actually, it is read in the main loop of the
 > autoprewarm_database_main() function:
 >
 > /* There are no free buffers left in shared buffers, break the loop. */
 > else if (!(*rs_have_free_buffer))
 > break;
 >
 > apw_read_stream_next_block() callback function sets
 > rs_have_free_buffer's value to false when there is no free buffer left
 > in the shared buffers. And the code above terminates the main loop in
 > the autoprewarm_database_main() function when it is set to false.
 >
 > block_range_read_stream_cb() callback is used when the callback only
 > needs to loop over the block numbers. However, for the autoprewarm
 > case; the callback function needs to do additional checks so another
 > callback and the use of this variable are required.

Ohh, I see, thanks very much for the explanation.

 > v3 is attached.

Thanks.

I don't know if there is another way that this patch could be tested? 
Looking
forward on other reviews on this.

--
Matheus Alcantara
EDB: https://www.enterprisedb.com




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