From: | Sami Imseih <samimseih(at)gmail(dot)com> |
---|---|
To: | Nathan Bossart <nathandbossart(at)gmail(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andres Freund <andres(at)anarazel(dot)de>, Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>, Rahila Syed <rahilasyed90(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Improve LWLock tranche name visibility across backends |
Date: | 2025-08-22 20:01:53 |
Message-ID: | CAA5RZ0tKoQeTuRsFmUjPAOEXBiyEGyePsqCAy-_oX4eFHSCmHw@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
>> If there is agreement on setting limits, may I propose
>> 1024 tranches and NAMEDATALEN. Both seem reasonably sufficient.
> Let's proceed with that approach for now. We can worry about the exact
> limits once this is closer to commit.
v11 implements the fixed size shared memory as discussed. So, as previous
versions, we totally got rid of LWLockRegisterTranche and users can
register tranches with either RequestNamedLWLockTranche ( during startup )
or LWLockNewTrancheId ( after startup ).
The NamedLWLockTrancheArray, allocated at the end of MainLWLockArray
with a fixed size limited to the number of tranches requested via
RequestNamedLWLockTranche, has been changed in v11.
It can now grow, up to a maximum number of total tranches,
currently 1024, indexed by LWLockCounter. We don't need to keep track
of the number of tranches in a separate variable, and can rely on
LWLockCounter only.
I kept the local array to serve consecutive reads and to avoid having to
take a shared lock on shared memory every time
GetLWTrancheName is called. A new LWLock to protect this array is
required.
LWLockInitialize also errors if the tranche used has not been registered,
as was the case in the previous patch versions.
Several error message to enforce the fixed size limits have also been added.
The next patch set has 0001 which is the core change, and 0002 are the
tests ( not sure if we need them, but they help in the review ).
The tests in 0002 fail on EXEC_BACKEND due to a newly discovered bug [0],
that repros on HEAD and likely other branches.
--
Sami
Attachment | Content-Type | Size |
---|---|---|
v11-0001-Improve-LWLock-tranche-registration.patch | application/octet-stream | 27.4 KB |
v11-0002-Tests-for-LWLock-tranche-registration-improvemen.patch | application/octet-stream | 12.5 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | e3718e7 | 2025-08-22 20:10:14 | [PATCH] Add Hebrew and Arabic combining characters to unaccent.rules |
Previous Message | Andres Freund | 2025-08-22 19:44:48 | Buffer locking is special (hints, checksums, AIO writes) |