From: | Nathan Bossart <nathandbossart(at)gmail(dot)com> |
---|---|
To: | Sami Imseih <samimseih(at)gmail(dot)com> |
Cc: | Rahila Syed <rahilasyed90(at)gmail(dot)com>, Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Improve LWLock tranche name visibility across backends |
Date: | 2025-08-12 19:48:50 |
Message-ID: | aJuaoouYv8l8f0PS@nathan |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
I haven't followed the latest discussion, but I took a look at the patch.
+ It is possible to use a <literal>tranche_id</literal> that was not retrieved
+ using <function>LWLockNewTrancheId</function>, but this is not recommended.
+ The ID may clash with an already registered tranche name, or the specified
+ name may not be found. In such cases, looking up the name will return a generic
+ "extension" tranche name.
Is there any reason to continue allowing this? For example, maybe we could
ERROR if LWLockInitialize()/GetLWTrancheName() are given a tranche_id
greater than the number allocated. I guess I'm not following why we should
gracefully handle these kinds of coding errors, especially when they result
in unhelpful behavior like an "extension" tranche.
+#else
+elog(ERROR, "injection points not supported");
+#endif
This causes compilation to fail when injection points are not enabled.
I haven't combed through the patch character-by-character, but upon a
read-through, the general shape looks reasonable to me. As a general note,
I'd suggest adding more commentary throughout and finding opportunities to
simplify and/or clean up the code as much as possible.
--
nathan
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas Munro | 2025-08-12 20:07:02 | Re: `pg_ctl init` crashes when run concurrently; semget(2) suspected |
Previous Message | Peter Eisentraut | 2025-08-12 19:41:47 | Re: GB18030-2022 Support in PostgreSQL |