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

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Reply via email to