summaryrefslogtreecommitdiff
path: root/src/backend/utils/init/postinit.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2005-07-29 19:30:09 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2005-07-29 19:30:09 +0000
commit5d5f1a79e674d5501f70f08bbb9b83d9bbaed319 (patch)
tree8e07dc9808e8a23029615c9fa6a8a110f9c68567 /src/backend/utils/init/postinit.c
parent507b758ad99c0e3a973097299b6b36688e7fec8e (diff)
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/utils/init/postinit.c')
-rw-r--r--src/backend/utils/init/postinit.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c
index d687c59ec6d..b013eca86cf 100644
--- a/src/backend/utils/init/postinit.c
+++ b/src/backend/utils/init/postinit.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/init/postinit.c,v 1.153 2005/07/14 05:13:41 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/init/postinit.c,v 1.154 2005/07/29 19:30:05 tgl Exp $
*
*
*-------------------------------------------------------------------------
@@ -78,6 +78,7 @@ FindMyDatabase(const char *name, Oid *db_id, Oid *db_tablespace)
char *filename;
FILE *db_file;
char thisname[NAMEDATALEN];
+ TransactionId frozenxid;
filename = database_getflatfilename();
db_file = AllocateFile(filename, "r");
@@ -86,7 +87,8 @@ FindMyDatabase(const char *name, Oid *db_id, Oid *db_tablespace)
(errcode_for_file_access(),
errmsg("could not open file \"%s\": %m", filename)));
- while (read_pg_database_line(db_file, thisname, db_id, db_tablespace))
+ while (read_pg_database_line(db_file, thisname, db_id,
+ db_tablespace, &frozenxid))
{
if (strcmp(thisname, name) == 0)
{
@@ -170,10 +172,11 @@ ReverifyMyDatabase(const char *name)
/*
* Also check that the database is currently allowing connections.
* (We do not enforce this in standalone mode, however, so that there is
- * a way to recover from "UPDATE pg_database SET datallowconn = false;")
+ * a way to recover from "UPDATE pg_database SET datallowconn = false;".
+ * We do not enforce it for the autovacuum process either.)
*/
dbform = (Form_pg_database) GETSTRUCT(tup);
- if (IsUnderPostmaster && !dbform->datallowconn)
+ if (IsUnderPostmaster && !IsAutoVacuumProcess() && !dbform->datallowconn)
ereport(FATAL,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("database \"%s\" is not currently accepting connections",