Commit 0914ae1c authored by Tom Lane's avatar Tom Lane

Remove the pgstats logic for delaying destruction of stats table entries.

Per recent discussion, this seems to be making the stats less accurate
rather than more so, particularly on Windows where PID values may be
reused very quickly.  Patch by Peter Brant.
parent 0bc2a8ca
......@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.15 2006/03/07 17:32:22 tgl Exp $
* $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.16 2006/04/06 20:38:00 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -384,19 +384,7 @@ AutoVacMain(int argc, char *argv[])
continue;
/*
* Don't try to access a database that was dropped. This could only
* happen if we read the pg_database flat file right before it was
* modified, after the database was dropped from the pg_database
* table. (This is of course a not-very-bulletproof test, but it's
* cheap to make. If we do mistakenly choose a recently dropped
* database, InitPostgres will fail and we'll drop out until the next
* autovac run.)
*/
if (tmp->entry->destroy != 0)
continue;
/*
* Else remember the db with oldest autovac time.
* Remember the db with oldest autovac time.
*/
if (db == NULL ||
tmp->entry->last_autovac_time < db->entry->last_autovac_time)
......@@ -417,6 +405,9 @@ AutoVacMain(int argc, char *argv[])
/*
* Connect to the selected database
*
* Note: if we have selected a just-deleted database (due to using
* stale stats info), we'll fail and exit here.
*/
InitPostgres(db->name, NULL);
SetProcessingMode(NormalProcessing);
......
This diff is collapsed.
......@@ -5,7 +5,7 @@
*
* Copyright (c) 2001-2006, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/include/pgstat.h,v 1.42 2006/03/05 15:58:53 momjian Exp $
* $PostgreSQL: pgsql/src/include/pgstat.h,v 1.43 2006/04/06 20:38:00 tgl Exp $
* ----------
*/
#ifndef PGSTAT_H
......@@ -271,16 +271,18 @@ typedef union PgStat_Msg
* ------------------------------------------------------------
*/
#define PGSTAT_FILE_FORMAT_ID 0x01A5BC94
#define PGSTAT_FILE_FORMAT_ID 0x01A5BC95
/* ----------
* PgStat_StatDBEntry The collector's data per database
*
* Note: n_backends is not maintained within the collector. It's computed
* when a backend reads the stats file for use.
* ----------
*/
typedef struct PgStat_StatDBEntry
{
Oid databaseid;
int destroy;
int n_backends;
PgStat_Counter n_xact_commit;
PgStat_Counter n_xact_rollback;
......@@ -325,24 +327,6 @@ typedef struct PgStat_StatBeEntry
} PgStat_StatBeEntry;
/* ----------
* PgStat_StatBeDead Because UDP packets can arrive out of
* order, we need to keep some information
* about backends that are known to be
* dead for some seconds. This info is held
* in a hash table of these structs.
*
* (This struct is not used in the stats file.)
* ----------
*/
typedef struct PgStat_StatBeDead
{
int procpid;
int backendid;
int destroy;
} PgStat_StatBeDead;
/* ----------
* PgStat_StatTabEntry The collector's data per table (or index)
* ----------
......@@ -350,7 +334,6 @@ typedef struct PgStat_StatBeDead
typedef struct PgStat_StatTabEntry
{
Oid tableid;
int destroy;
PgStat_Counter numscans;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment