From: | wenhui qiu <qiuwenhuifx(at)gmail(dot)com> |
---|---|
To: | Michael Paquier <michael(at)paquier(dot)xyz> |
Cc: | Karina Litskevich <litskevichkarina(at)gmail(dot)com>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: pg_stat_statements: Avoid holding excessive lock |
Date: | 2024-11-08 09:49:45 |
Message-ID: | CAGjGUAJp1Ms06E0d6Z40K8OJ2cGiU1jjwa4MPe8LaZQ3z2cuFw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi Karina Liskevich
> + /*
> + * There is no need to hold entry->mutex when reading
stats_since and
> + * minmax_stats_since for (unlike counters) they are always
written
> + * while holding pgss->lock exclusively. We are holding
pgss->lock
> + * shared so there should be no race here.
> + */
> stats_since = entry->stats_since;
> minmax_stats_since = entry->minmax_stats_since;
> - SpinLockRelease(&entry->mutex);
>> The comment could be simpler, say a "The spinlock is not required when
>> reading these two as they are always updated when holding pgss->lock
>> exclusively.". Or something like that.
Agree , It reduces the lock time , The new comment are short and concise,
It sounds good .
Michael Paquier <michael(at)paquier(dot)xyz> 于2024年11月8日周五 14:08写道:
> On Thu, Nov 07, 2024 at 04:08:30PM +0300, Karina Litskevich wrote:
> > Thank you for your feedback and the shorter wording of the comment.
> > I used it in the new version of the patch.
>
> After a second look, sounds good to me. Let's wait a bit and see of
> others have comments or thoughts to share.
> --
> Michael
>
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Kapila | 2024-11-08 09:51:47 | Re: Commit Timestamp and LSN Inversion issue |
Previous Message | Dilip Kumar | 2024-11-08 09:47:04 | Fix small typo, use InvalidRelFileNumber instead of InvalidOid |