diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-07-29 19:30:09 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-07-29 19:30:09 +0000 |
commit | 5d5f1a79e674d5501f70f08bbb9b83d9bbaed319 (patch) | |
tree | 8e07dc9808e8a23029615c9fa6a8a110f9c68567 /src/backend/commands/vacuum.c | |
parent | 507b758ad99c0e3a973097299b6b36688e7fec8e (diff) | |
download | postgresql-5d5f1a79e674d5501f70f08bbb9b83d9bbaed319.tar.gz postgresql-5d5f1a79e674d5501f70f08bbb9b83d9bbaed319.zip |
Clean up a number of autovacuum loose ends. Make the stats collector
track shared relations in a separate hashtable, so that operations done
from different databases are counted correctly. Add proper support for
anti-XID-wraparound vacuuming, even in databases that are never connected
to and so have no stats entries. Miscellaneous other bug fixes.
Alvaro Herrera, some additional fixes by Tom Lane.
Diffstat (limited to 'src/backend/commands/vacuum.c')
-rw-r--r-- | src/backend/commands/vacuum.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c index 23b0911e8cc..9db91209448 100644 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c @@ -13,7 +13,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.311 2005/07/14 05:13:39 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.312 2005/07/29 19:30:03 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -41,6 +41,7 @@ #include "tcop/pquery.h" #include "utils/acl.h" #include "utils/builtins.h" +#include "utils/flatfiles.h" #include "utils/fmgroids.h" #include "utils/inval.h" #include "utils/lsyscache.h" @@ -490,7 +491,7 @@ vacuum(VacuumStmt *vacstmt, List *relids) * If it was a database-wide VACUUM, print FSM usage statistics * (we don't make you be superuser to see these). */ - if (vacstmt->relation == NULL) + if (all_rels) PrintFreeSpaceMapStatistics(elevel); /* @@ -712,7 +713,7 @@ vac_update_relstats(Oid relid, BlockNumber num_pages, double num_tuples, * vac_update_dbstats() -- update statistics for one database * * Update the whole-database statistics that are kept in its pg_database - * row. + * row, and the flat-file copy of pg_database. * * We violate no-overwrite semantics here by storing new values for the * statistics columns directly into the tuple that's already on the page. @@ -721,8 +722,6 @@ vac_update_relstats(Oid relid, BlockNumber num_pages, double num_tuples, * * This routine is shared by full and lazy VACUUM. Note that it is only * applied after a database-wide VACUUM operation. - * - * Note that we don't bother to update the flat-file copy of pg_database. */ static void vac_update_dbstats(Oid dbid, @@ -768,6 +767,9 @@ vac_update_dbstats(Oid dbid, heap_endscan(scan); heap_close(relation, RowExclusiveLock); + + /* Mark the flat-file copy of pg_database for update at commit */ + database_file_update_needed(); } @@ -1165,8 +1167,8 @@ full_vacuum_rel(Relation onerel, VacuumStmt *vacstmt) vacrelstats->rel_tuples, vacrelstats->hasindex); /* report results to the stats collector, too */ - pgstat_report_vacuum(RelationGetRelid(onerel), vacstmt->analyze, - vacrelstats->rel_tuples); + pgstat_report_vacuum(RelationGetRelid(onerel), onerel->rd_rel->relisshared, + vacstmt->analyze, vacrelstats->rel_tuples); } |