Re: identifying the backend that owns a temporary schema

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: Greg Stark <stark(at)mit(dot)edu>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: identifying the backend that owns a temporary schema
Date: 2022-09-28 22:56:20
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Nathan Bossart <nathandbossart(at)gmail(dot)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

Attachment Content-Type Size
v5-0001-use-real-backend-id.patch text/x-diff 13.2 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2022-09-28 22:58:17 Re: A potential memory leak on Merge Join when Sort node is not below Materialize node
Previous Message Thomas Munro 2022-09-28 22:53:02 Re: making relfilenodes 56 bits