Re: identifying the backend that owns a temporary schema
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Nathan Bossart <nathandbossart@gmail.com>
Cc: Greg Stark <stark@mit.edu>, pgsql-hackers@postgresql.org
Date: 2022-09-28T22:56:20Z
Lists: pgsql-hackers
Attachments
- v5-0001-use-real-backend-id.patch (text/x-diff) patch v5-0001
Nathan Bossart <nathandbossart@gmail.com> writes: > Thanks for the suggestion. I used it in v4 of the patch. I reviewed this and made some changes, some cosmetic some less so. Notably, I was bemused that of the four calls of pgstat_fetch_stat_local_beentry, three tested for a NULL result even though they cannot get one, while the fourth (pg_stat_get_backend_idset) *is* at hazard of a NULL result but lacked a check. I changed pg_stat_get_backend_idset so that it too cannot get a NULL, and deleted the dead code from the other callers. A point that still bothers me a bit about pg_stat_get_backend_idset is that it could miss or duplicate some backend IDs if the user calls pg_stat_clear_snapshot() partway through the SRF's run, and we reload a different set of backend entries than we had before. I added a comment about that, with an argument why it's not worth working harder, but is the argument convincing? If not, what should we do? Also, I realized that the functions we're changing here are mostly not exercised in the current regression tests :-(. So I added a small test case. I think this is probably committable if you agree with my changes. regards, tom lane
Commits
-
Use actual backend IDs in pg_stat_get_backend_idset() and friends.
- d7e39d72ca1c 16.0 landed