From: | Srinath Reddy Sadipiralla <srinath2133(at)gmail(dot)com> |
---|---|
To: | Greg Sabino Mullane <htamfids(at)gmail(dot)com> |
Cc: | "duomi(dot)peng" <duomi(dot)peng(at)qq(dot)com>, pgsql-bugs <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
Subject: | Re: bug reapper: Empty query_id in pg_stat_activity |
Date: | 2025-08-28 12:25:27 |
Message-ID: | CAFC+b6pU_XRKZu=wF6A-9Aqp6SW1Z1vZ62Ggp3PJpuKvYM9T4A@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Thu, Aug 28, 2025 at 5:40 PM Greg Sabino Mullane <htamfids(at)gmail(dot)com>
wrote:
> If I am reading the code in utils/activity/backend_status.c correctly, I
> not only see where it is happening (pgstat_report_activity), but why it is
> happening as well.
>
sorry for half cooked analysis ,the reason is pgstat_report_query_id()
zeroes st_query_id before the new one is computed in exec_simple_query(). A
concurrent reader of pg_stat_activity during that narrow timing gap
observes 0 (displayed as NULL). The fix I tried is to retain the previous
query_id (prev_st_query_id) and return it when st_query_id is still 0 but
query_id computation is enabled, thoughts?
--
Thanks,
Srinath Reddy Sadipiralla
EDB: https://www.enterprisedb.com/
Attachment | Content-Type | Size |
---|---|---|
v1-0001-Fix-transient-NULL-query_id-in-pg_stat_activity.patch | application/octet-stream | 3.3 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Srinath Reddy Sadipiralla | 2025-08-28 12:28:10 | Re: bug reapper: Empty query_id in pg_stat_activity |
Previous Message | Greg Sabino Mullane | 2025-08-28 12:09:42 | Re: bug reapper: Empty query_id in pg_stat_activity |