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

pgstat: reduce message header

From: Neil Conway <neilc(at)samurai(dot)com>
To: pgsql-patches <pgsql-patches(at)postgresql(dot)org>
Subject: pgstat: reduce message header
Date: 2005-05-10 04:14:33
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-patches
This patch reduces the size of the message header used by statistics 
collector messages, per recent discussion. This actually required quite 
a few changes -- for example, "databaseid != InvalidOid" was used to 
check whether a slot in the backend entry table was initialized, but 
that no longer works since the slot might be initialized prior to 
receiving the BESTART message which contains the database id. We know 
use procpid > 0 to indicate that a slot is non-empty.

Other changes:

- various comment improvements and cleanups

- there's no need to zero-out the entire activity buffer in 
pgstat_add_backend(), we can just set activity[0] to '\0'.

- remove the counting of the # of connections to a database; this was 
not used anywhere

One change in behavior I wasn't sure about: previously, the code would 
create a hash table entry for a database as soon as any message was 
received whose header referenced that database. Now, we only create hash 
table entries as needed (so for example BESTART won't create a hash 
table entry, since it doesn't need to access the per-db hash table). Is 
it important that we retain the previous behavior? (It would be easy 
enough to do by just calling pgstat_get_db_entry() when processing a 

Barring any objections I'll apply this to HEAD tomorrow.


Attachment: pgstat_msg_hdr_cleanup-4.patch
Description: text/x-patch (18.8 KB)


pgsql-patches by date

Next:From: Neil ConwayDate: 2005-05-10 06:14:16
Subject: cleanup: remove MemSet() casts
Previous:From: Joshua D. DrakeDate: 2005-05-10 03:21:26
Subject: Re: [HACKERS] read-only database

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