Re: [BUG] temporary file usage report with extended protocol and unnamed portals
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Sami Imseih <samimseih@gmail.com>
Cc: Mircea Cadariu <cadariu.mircea@gmail.com>, Frédéric Yhuel <frederic.yhuel@dalibo.com>, Tom Lane <tgl@sss.pgh.pa.us>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Benoit Lobréau <benoit.lobreau@dalibo.com>, Guillaume Lelarge <guillaume.lelarge@dalibo.com>, Pierrick Chovelon <pierrick.chovelon@dalibo.com>
Date: 2025-09-16T06:22:55Z
Lists: pgsql-hackers
On Thu, Sep 11, 2025 at 10:28:50AM -0500, Sami Imseih wrote:
> > Only question is if we should avoid the extra portal hashtable lookup as well, or leave that for a separate patch.
>
> I prefer a separate thread for this, as it's an optimization of the
> existing behavior.
- portal = CreatePortal("", true, true);
+ if (!unnamed_portal)
+ portal = CreatePortalOnly("");
+ else
+ portal = CreatePortal("", true, true);
[...]
-CreatePortal(const char *name, bool allowDup, bool dupSilent)
+CreatePortalOnly(const char *name)
+Portal
+CreatePortal(const char *name, bool allowDup, bool dupSilent)
Talking about v9 here, as far as I can see. I don't think that it is
a wise idea to create a new API for this layer, while duplicating two
times the same pattern where the old CreatePortal() function and the
new CreatePortalOnly() function are called. CreatePortalOnly() is
called by CreatePortal(), adding to the confusion. If we refactor
this API, it may be an idea to use a bits32 with two flags rather than
two booleans, especially if we justify a third boolean case. That
would make CreatePortal() more solid on ABI grounds in the long-term,
as well.
Just my 2c while looking at this particular part of the thread. Now
to the main patch proposed, v8 or v10..
--
Michael
Commits
-
Drop unnamed portal immediately after execution to completion
- 1fd981f05369 19 (unreleased) landed
-
Override log_error_verbosity to "default" in test 009_log_temp_files
- 02c171f63fca 19 (unreleased) landed
-
Add tests for logging of temporary file removal and statement
- 76bba033128a 19 (unreleased) landed