From: | Heikki Linnakangas <hlinnaka(at)iki(dot)fi> |
---|---|
To: | Ildus Kurbangaliev <i(dot)kurbangaliev(at)postgrespro(dot)ru>, pgsql-hackers(at)postgresql(dot)org, Robert Haas <robertmhaas(at)gmail(dot)com>, Alexander Korotkov <aekorotkov(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
Subject: | Re: RFC: replace pg_stat_activity.waiting with something more descriptive |
Date: | 2015-07-28 19:28:00 |
Message-ID: | 55B7D7C0.3030907@iki.fi |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 07/27/2015 01:20 PM, Ildus Kurbangaliev wrote:
> Hello.
> In the attached patch I've made a refactoring for tranches.
> The prefix for them was extended, and I've did a split of LWLockAssign
> to two
> functions (one with tranche and second for user defined LWLocks).
This needs some work in order to be maintainable:
* The patch requires that the LWLOCK_INDIVIDUAL_NAMES array is kept in
sync with the list of individual locks in lwlock.h. Sooner or later
someone will add an LWLock and forget to update the names-array. That
needs to be made less error-prone, so that the names are maintained in
the same place as the #defines. Perhaps something like rmgrlist.h.
* The "base" tranches are a bit funny. They all have the same
array_base, pointing to MainLWLockArray. If there are e.g. 5 clog buffer
locks, I would expect the T_NAME() to return "ClogBufferLocks" for all
of them, and T_ID() to return numbers between 0-4. But in reality,
T_ID() will return something like 55-59.
Instead of passing a tranche-id to LWLockAssign(), I think it would be
more clear to have a new function to allocate a contiguous block of
lwlocks as a new tranche. It could then set the base correctly.
* Instead of having LWLOCK_INDIVIDUAL_NAMES to name "individual" locks,
how about just giving each one of them a separate tranche?
* User manual needs to be updated to explain the new column in
pg_stat_activity.
- Heikki
From | Date | Subject | |
---|---|---|---|
Next Message | Evgeniy Shishkin | 2015-07-28 19:29:15 | Re: TODO: replica information functions |
Previous Message | Robert Haas | 2015-07-28 19:27:51 | Re: security labels on databases are bad for dump & restore |