From: | Greg Sabino Mullane <htamfids(at)gmail(dot)com> |
---|---|
To: | Srinath Reddy Sadipiralla <srinath2133(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:09:42 |
Message-ID: | CAKAnmmJCuif76-RF5BLfmKrLS_8FQcivad2UbT9S-P3kGFyUmQ@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
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. There is definitely a race condition as we know what the
query is before we have a chance to parse it and generate a query
identifier for it. I'm not sure of the solution - we cannot exclude null
query identifiers from the output, or callers will see the backend
disappear briefly! We cannot avoid setting it to 0, as then we could have a
query != query_id. We could store the query string somewhere and only
reveal it once we have the identifier, but that's also tricky because we
risk not setting it (and because we also set other things at the same time
as the name, which would then be further disconnected). But maybe its the
best option? I do agree this is a bug (and like Srinath, I can duplicate
easily).
Anyway, my pre-caffeine two cents.
Cheers,
Greg
--
Crunchy Data - https://www.crunchydata.com
Enterprise Postgres Software Products & Tech Support
From | Date | Subject | |
---|---|---|---|
Next Message | Srinath Reddy Sadipiralla | 2025-08-28 12:25:27 | Re: bug reapper: Empty query_id in pg_stat_activity |
Previous Message | PG Bug reporting form | 2025-08-28 12:09:30 | BUG #19034: Recursive function with sql_body can replace an existing function but can not be created on it's own |