Re: Improve LWLock tranche name visibility across backends
От | Sami Imseih |
---|---|
Тема | Re: Improve LWLock tranche name visibility across backends |
Дата | |
Msg-id | CAA5RZ0tKoQeTuRsFmUjPAOEXBiyEGyePsqCAy-_oX4eFHSCmHw@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Improve LWLock tranche name visibility across backends (Nathan Bossart <nathandbossart@gmail.com>) |
Ответы |
Re: Improve LWLock tranche name visibility across backends
|
Список | 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 [0] https://www.postgresql.org/message-id/CAA5RZ0v1_15QPg5Sqd2Qz5rh_qcsyCeHHmRDY89xVHcy2yt5BQ%40mail.gmail.com
Вложения
В списке pgsql-hackers по дате отправления: