From: Alexander Lakhin <exclusion@gmail.com>
To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17804: Assertion failed in pg_stat after fetching from pg_stat_database and switching cache->snapshot
Date: Fri, 28 Apr 2023 07:00:01 +0300
Message-ID: <0d45c9c1-17a1-932f-3925-86484f150c94@gmail.com> (raw)
In-Reply-To: <20230428.104100.1566874883906441360.horikyota.ntt@gmail.com>
References: <20230224.160812.1001813717917457753.horikyota.ntt@gmail.com>
<1836967a-9f78-aed8-1ff1-3351c504e8f0@gmail.com>
<f3f81a47-e417-f23e-ac4b-8ef3b32c7b93@gmail.com>
<20230428.104100.1566874883906441360.horikyota.ntt@gmail.com>
Hello Kyotaro-san,
28.04.2023 04:41, Kyotaro Horiguchi wrote:
> Nonetheless, I'm a bit concerned about making a direct call to
> pgstat_clear_snapshot() from the assign callback, it might be fine for
> now, but I worry that it could an issue later on.
>
> So, how about just settin a trigger that causes a snapshot clearing
> prior to the next use, like the attached?
I'm agree with the change — it's still rather simple and fixes the issue.
Maybe you would also find appropriate to update the comment for
pgstat_get_stat_snapshot_timestamp().
Perhaps add something like?:
Note that the snapshot may be cleared here, if requested.
> As for the test, I can't come up with a better one, but I think the
> comment should explain its intention more clearly.
I'd hesitated to mention a crash in the comment because I've seen
assertion failures only (and no crash with a non-assert build), so I
thought that the test should illustrate the new behavior in the first place.
But I'm not opposed to your comment change, maybe it's more prominent indeed.
Thank you for the fix!
Best regards,
Alexander
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: exclusion@gmail.com, horikyota.ntt@gmail.com, pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17804: Assertion failed in pg_stat after fetching from pg_stat_database and switching cache->snapshot
In-Reply-To: <0d45c9c1-17a1-932f-3925-86484f150c94@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox