Re: limiting connections per user/database

Поиск
Список
Период
Сортировка
От Neil Conway
Тема Re: limiting connections per user/database
Дата
Msg-id 42BF8BBE.6040102@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 looked at this but did not actually see the code path that requires
> forcing creation of the per-DB entry right at this spot.  The HASH_FIND
> calls for this hashtable seem to all happen on the backend side not the
> collector side.  Can you explain why we need this?

Yeah, I missed this when making the original change (this code is rather
opaque :-\). The problem is that if we don't initialize the dbentry for
the database we connect to, it won't get written out to the statsfile in
pgstat_write_statsfile(). So the database won't be counted as having any
backends connected to it in pgstat_read_statsfile() (see line 2558 of
pgstat.c in HEAD).

BTW, the comment at line 2210 of pgstat.c is misleading: the n_backends
in the entries of the dbentry hash table are explicitly ignored when
reading in the stats file -- the value is instead derived from the
number of beentries that are seen.

-Neil

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: limiting connections per user/database
Следующее
От: Tom Lane
Дата:
Сообщение: Re: limiting connections per user/database