Alvaro Herrera <alvherre@commandprompt.com> writes:
> The problem is that the database hash is cleared of databases that no
> longer exist, and the database list is constructed by scanning
> pg_database. Since no entry exist for the database we use for shared
> tables (InvalidOid), the hash table is dropped.
Doh ...
> The attached patch fixes this.
Wouldn't it be easier to just special-case the shared DB in
pgstat_vacuum_tabstat?
while ((dbentry = (PgStat_StatDBEntry *) hash_seq_search(&hstat)) != NULL) { Oid dbid =
dbentry->databaseid;
CHECK_FOR_INTERRUPTS();
- if (hash_search(htab, (void *) &dbid, HASH_FIND, NULL) == NULL)
+ /* ignore the DB entry for shared tables ... they never go away */
+ if (OidIsValid(dbid) &&
+ hash_search(htab, (void *) &dbid, HASH_FIND, NULL) == NULL) pgstat_drop_database(dbid); }
>> Additionally, in 8.3devel doing anything that queries or modifies a
>> shared table seems to zero the statistics for all shared tables.
> I'm not sure if this is fixed by the patch; can you verify, or provide a
> more specific description of the problem?
Seems unlikely that this bug would explain a behavior like that.
regards, tom lane