From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | Ildus Kurbangaliev <i(dot)kurbangaliev(at)postgrespro(dot)ru> |
Cc: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, "andres(at)anarazel(dot)de" <andres(at)anarazel(dot)de>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi> |
Subject: | Re: [PATCH] Refactoring of LWLock tranches |
Date: | 2015-11-15 21:24:24 |
Message-ID: | CA+TgmoYciHS4FuU2rYNt8bX0+7ZcNRBGeO-L20apcXTeo7=48w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Nov 13, 2015 at 11:37 AM, Ildus Kurbangaliev
<i(dot)kurbangaliev(at)postgrespro(dot)ru> wrote:
> Thanks! That's very inspiring.
Cool. It was great work; I am very happy with how it turned out.
> I have some questions about next steps on other tranches.
> First of all, I think we can have two API calls, something like:
>
> 1) LWLockRequestTranche(char *tranche_name, int locks_count)
> 2) LWLockGetTranche(char *tranche_name)
>
> LWLockRequestTranche reserve an item in main tranches array in shared memory, and
> allocates space for name, LWLockTranche and LWLocks. There is first question. It is
> ok if this call will be from *ShmemSize functions? We keep those requests,
> calculate a required size in LWLockShmemSize (by moving this call to the end)
> and create all these tranches in CreateLWLocks.
I think what we should do about the buffer locks is polish up this
patch and get it applied:
http://www.postgresql.org/message-id/20150907175909.GD5084@alap3.anarazel.de
I think it needs to be adapted to use predefined constants for the
tranche IDs instead of hardcoded values, maybe based on the attached
tranche-constants.patch. This approach could be extended for the
other stuff in the main tranche, and I think that would be cleaner
than inventing LWLockRequestTranche as you are proposing. Just make
the tranche IDs constants, and then the rest fits nicely into the
framework we've already got.
Also, I think we should rip all the volatile qualifiers out of
bufmgr.c, using the second attached patch, devolatileize-bufmgr.patch.
The comment claiming that we need this because spinlocks aren't
compiler barriers is obsolete.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Attachment | Content-Type | Size |
---|---|---|
tranche-constants.patch | text/x-patch | 2.3 KB |
devolatileize-bufmgr.patch | text/x-patch | 16.2 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas Munro | 2015-11-15 22:24:05 | Re: Proposal: "Causal reads" mode for load balancing reads without stale data |
Previous Message | Jim Nasby | 2015-11-15 20:20:03 | Re: psql: add \pset true/false |