| From: | shihao zhong <zhong950419(at)gmail(dot)com> |
|---|---|
| To: | Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com> |
| Cc: | Michael Paquier <michael(at)paquier(dot)xyz>, Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>, pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Add a permission check to pg_stat_get_backend_subxact() |
| Date: | 2026-09-25 03:40:01 |
| Message-ID: | CAGRkXqQhhFu+gRA6uie81FBfL+7W-7ZPumDdx5E1iZvY-QtK2g@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi Bertrand,
> Maybe worth adding a comment to pgstat_fetch_stat_backend_by_pid()
mentioning that
> cached statistics may belong to an older backend that used the same
ProcNumber,
> to avoid this being rediscovered later? (If so, I'll draft such a patch).
Thanks, I added it to v11-0001, so no need for a separate patch. v11-0002
is the same as v10-0002.
> Agreed. What about v10-0002? I think this is different.
One more point for Michael. 0002 does not change stats_fetch_consistency
or drop anything fetched earlier. It only checks, while the activity
snapshot is built, that each entry takes its status and its PGPROC fields
from the same backend. If the PID does not match, that backend has exited,
so no xid and no subxacts is the right answer for it.
Thanks,
Shihao
| Attachment | Content-Type | Size |
|---|---|---|
| v11-0002-Check-the-PID-when-reading-the-transaction-statu.patch | application/octet-stream | 3.5 KB |
| v11-0001-Make-per-backend-statistics-functions-respect-st.patch | application/octet-stream | 16.4 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Michael Paquier | 2026-09-25 04:01:57 | Re: Add a permission check to pg_stat_get_backend_subxact() |
| Previous Message | Manu | 2026-09-25 03:19:06 | Re: Temp schema drop leaves an inconsistent state behind |