Skip site navigation (1) Skip section navigation (2)

Re: limiting connections per user/database

From: Neil Conway <neilc(at)samurai(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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 06:35:14
Message-ID: 42BF9E22.10404@samurai.com (view raw or flat)
Thread:
Lists: 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

In response to

Responses

pgsql-patches by date

Next:From: Stephen FrostDate: 2005-06-27 06:40:36
Subject: Re: Users/Groups -> Roles
Previous:From: Stephen FrostDate: 2005-06-27 06:29:49
Subject: Users/Groups -> Roles

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group