Re: limiting connections per user/database

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: Petr Jelínek <pjmodos(at)parba(dot)cz>, pgsql-patches(at)postgresql(dot)org
Subject: Re: limiting connections per user/database
Date: 2005-06-27 13:51:02
Message-ID: 5986.1119880262@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Neil Conway <neilc(at)samurai(dot)com> writes:
> - 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.

However, this could equally be fixed by replacing the hash_search call
at l. 2554 by pgstat_get_db_entry(). If your definition of "correct"
is that "a new backend can see at least one backend in its own database"
then this would be a more appropriate fix anyway, since there's a lag
between sending BESTART and seeing any result in the collector's output.

This isn't an argument against moving the responsibility for counting
n_backends into the collector, but as long as it's done in
pgstat_read_statsfile the proposed fix is pretty bogus.

regards, tom lane

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Michael Fuhr 2005-06-27 13:53:23 PL/Python error checking
Previous Message Andrew Dunstan 2005-06-27 13:49:54 Re: regexp_replace