From: | Matheus Alcantara <matheusssilv97(at)gmail(dot)com> |
---|---|
To: | Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Using read stream in autoprewarm |
Date: | 2024-11-28 16:45:40 |
Message-ID: | 8a0f6b95-5c37-47ff-94f9-4ff19f161168@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wednesday, November 27th, 2024 at 11:19 AM, Nazir Bilal Yavuz
<byavuz81(at)gmail(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2024-11-28 17:18:54 | Re: Changing shared_buffers without restart |
Previous Message | Dmitry Dolgov | 2024-11-28 16:30:32 | Re: Changing shared_buffers without restart |