| From: | Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com> |
|---|---|
| To: | 邱宇航 <iamqyh(at)gmail(dot)com> |
| Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Re: Add pg_buffercache_mark_dirty[_all] functions to the pg_buffercache |
| Date: | 2025-11-24 07:50:03 |
| Message-ID: | CAN55FZ1BcYgs5f2HH81CRjdOxxfnuLZO5bbBUv4jC9evxLdDGg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
Thank you for looking into this!
On Mon, 24 Nov 2025 at 09:51, 邱宇航 <iamqyh(at)gmail(dot)com> wrote:
>
> I suggest using a conditional lock on the buffer, which would be more
> appropriate here.
Could you please explain that a bit more? AFAIU, conditional locks are
mainly used to escape from deadlock situations and we can not cause a
deadlock here. Is it because using conditional locks might make the
functions faster by skipping the wait situations?
> Additionally, the function should return whether
> the buffer is marked as dirty, the number of buffers marked as dirty.
>
> This change would also make pg_buffercache_mark_dirty_{relation, all}
> behave more consistently with pg_buffercache_evict_{relation,all}.
Do you mean that we should not return 'buffer_already_dirty'
information and we should only return 'buffer_dirtied' information in
the 'pg_buffercache_mark_dirty' function? If you are suggesting that,
I think returning 'buffer_already_dirty' has a value in it.
> Lastly, `CHECK_FOR_INTERRUPTS()` should be added inside the loop over
> `NBuffers` to ensure it can be interrupted during long-running
> operations.
You are right, applied to v9 in the email below [1].
[1] https://postgr.es/m/CAN55FZ1E4ruwjjarUc0WoHxSpW%3DCZ0aEPfSrUC4z65UtEM7DNw%40mail.gmail.com
--
Regards,
Nazir Bilal Yavuz
Microsoft
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Chao Li | 2025-11-24 08:07:59 | Re: eliminate xl_heap_visible to reduce WAL (and eventually set VM on-access) |
| Previous Message | Nazir Bilal Yavuz | 2025-11-24 07:48:24 | Re: Add pg_buffercache_mark_dirty[_all] functions to the pg_buffercache |