From 29094193f526bf90671d71b59a2e007aad1fcae5 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 14 Jul 2005 05:13:45 +0000 Subject: Integrate autovacuum functionality into the backend. There's still a few loose ends to be dealt with, but it seems to work. Alvaro Herrera, based on the contrib code by Matthew O'Connor. --- src/backend/utils/init/postinit.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/backend/utils/init/postinit.c') diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c index 18e60cab0f1..d687c59ec6d 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.152 2005/07/04 04:51:50 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/init/postinit.c,v 1.153 2005/07/14 05:13:41 tgl Exp $ * * *------------------------------------------------------------------------- @@ -29,6 +29,7 @@ #include "libpq/hba.h" #include "mb/pg_wchar.h" #include "miscadmin.h" +#include "postmaster/autovacuum.h" #include "postmaster/postmaster.h" #include "storage/backendid.h" #include "storage/fd.h" @@ -268,7 +269,8 @@ BaseInit(void) * InitPostgres * Initialize POSTGRES. * - * In bootstrap mode neither of the parameters are used. + * In bootstrap mode neither of the parameters are used. In autovacuum + * mode, the username parameter is not used. * * The return value indicates whether the userID is a superuser. (That * can only be tested inside a transaction, so we want to do it during @@ -282,6 +284,7 @@ bool InitPostgres(const char *dbname, const char *username) { bool bootstrap = IsBootstrapProcessingMode(); + bool autovacuum = IsAutoVacuumProcess(); bool am_superuser; /* @@ -402,10 +405,11 @@ InitPostgres(const char *dbname, const char *username) RelationCacheInitializePhase2(); /* - * Figure out our postgres user id. In standalone mode we use a fixed - * id, otherwise we figure it out from the authenticated user name. + * Figure out our postgres user id. In standalone mode and in the + * autovacuum process, we use a fixed id, otherwise we figure it out from + * the authenticated user name. */ - if (bootstrap) + if (bootstrap || autovacuum) InitializeSessionUserIdStandalone(); else if (!IsUnderPostmaster) { @@ -441,7 +445,7 @@ InitPostgres(const char *dbname, const char *username) /* * Check if user is a superuser. */ - if (bootstrap) + if (bootstrap || autovacuum) am_superuser = true; else am_superuser = superuser(); -- cgit v1.2.3