Re: RFC: replace pg_stat_activity.waiting with something more descriptive

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема Re: RFC: replace pg_stat_activity.waiting with something more descriptive
Дата
Msg-id 55B7D7C0.3030907@iki.fi
обсуждение исходный текст
Ответ на Re: RFC: replace pg_stat_activity.waiting with something more descriptive  (Ildus Kurbangaliev <i.kurbangaliev@postgrespro.ru>)
Ответы Re: RFC: replace pg_stat_activity.waiting with something more descriptive  (Ildus Kurbangaliev <i.kurbangaliev@postgrespro.ru>)
Re: RFC: replace pg_stat_activity.waiting with something more descriptive  (Robert Haas <robertmhaas@gmail.com>)
Список 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




В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: security labels on databases are bad for dump & restore
Следующее
От: Evgeniy Shishkin
Дата:
Сообщение: Re: TODO: replica information functions