Re: limiting connections per user/database

Поиск
Список
Период
Сортировка
От Neil Conway
Тема Re: limiting connections per user/database
Дата
Msg-id 42BF9E22.10404@samurai.com
обсуждение исходный текст
Ответ на Re: limiting connections per user/database  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: limiting connections per user/database  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-patches
Tom Lane wrote:
> I'm still missing what the exact "bug fix" is here.

The bug is:

- a backend starts up and sends the collector a BESTART message. For the
sake of clarity, suppose that the backend is the first and only backend
connected to its database.

- the stats collector receives the BESTART message and records the
existence of the backend via pgstat_add_backend(). In current sources,
it does not initialize the entry for the backend's database in pgStatDBHash.

- the stats collector then decides to write out the stats file. Since
there is no pgStatDBHash entry for the backend's database, we don't
write out anything for it.

- when we read in the stats collector's stats file in a normal backend,
there will be no pgStatDBHash entry for the backend's database.
Therefore we'll read the beentry for the backend, and when we go to
increment the n_backends for the corresponding dbentry, there will be no
dbentry found (HASH_FIND at pgstat.c:2554), so n_backends won't be updated.

- therefore we won't count the n_backends for the database correctly.

This can be seen in current sources with a fresh initdb and default
postgresql.conf settings: connect to a database, and do select * from
pg_stat_database.

-Neil

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

Предыдущее
От: Stephen Frost
Дата:
Сообщение: Users/Groups -> Roles
Следующее
От: Stephen Frost
Дата:
Сообщение: Re: Users/Groups -> Roles