diff options
Diffstat (limited to 'src/backend/utils')
| -rw-r--r-- | src/backend/utils/init/globals.c | 6 | ||||
| -rw-r--r-- | src/backend/utils/init/postinit.c | 25 | ||||
| -rw-r--r-- | src/backend/utils/misc/guc.c | 12 |
3 files changed, 26 insertions, 17 deletions
diff --git a/src/backend/utils/init/globals.c b/src/backend/utils/init/globals.c index e4f5dfa584..fe2cef87d3 100644 --- a/src/backend/utils/init/globals.c +++ b/src/backend/utils/init/globals.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/init/globals.c,v 1.109 2009/08/28 18:23:53 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/init/globals.c,v 1.110 2009/08/31 19:41:00 tgl Exp $ * * NOTES * Globals used all over the place should be declared here and not @@ -100,8 +100,8 @@ int maintenance_work_mem = 16384; /* * Primary determinants of sizes of shared-memory structures. MaxBackends is - * MaxConnections + autovacuum_max_workers (it is computed by the GUC assign - * hook): + * MaxConnections + autovacuum_max_workers + 1 (it is computed by the GUC + * assign hooks for those variables): */ int NBuffers = 1000; int MaxBackends = 100; diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c index 11eeec353c..2d7253312f 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.195 2009/08/29 19:26:51 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/init/postinit.c,v 1.196 2009/08/31 19:41:00 tgl Exp $ * * *------------------------------------------------------------------------- @@ -460,7 +460,9 @@ BaseInit(void) * name can be returned to the caller in out_dbname. If out_dbname isn't * NULL, it must point to a buffer of size NAMEDATALEN. * - * In bootstrap mode no parameters are used. + * In bootstrap mode no parameters are used. The autovacuum launcher process + * doesn't use any parameters either, because it only goes far enough to be + * able to read pg_database; it doesn't connect to any particular database. * * 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 @@ -538,6 +540,12 @@ InitPostgres(const char *in_dbname, Oid dboid, const char *username, pgstat_initialize(); /* + * Load relcache entries for the shared system catalogs. This must + * create at least an entry for pg_database. + */ + RelationCacheInitializePhase2(); + + /* * Set up process-exit callback to do pre-shutdown cleanup. This has to * be after we've initialized all the low-level modules like the buffer * manager, because during shutdown this has to run before the low-level @@ -548,10 +556,17 @@ InitPostgres(const char *in_dbname, Oid dboid, const char *username, */ on_shmem_exit(ShutdownPostgres, 0); + /* The autovacuum launcher is done here */ + if (IsAutoVacuumLauncherProcess()) + return true; /* result doesn't matter */ + /* * Start a new transaction here before first access to db, and get a * snapshot. We don't have a use for the snapshot itself, but we're * interested in the secondary effect that it sets RecentGlobalXmin. + * (This is critical for anything that reads heap pages, because HOT + * may decide to prune them even if the process doesn't attempt to + * modify any tuples.) */ if (!bootstrap) { @@ -560,12 +575,6 @@ InitPostgres(const char *in_dbname, Oid dboid, const char *username, } /* - * Load relcache entries for the shared system catalogs. This must - * create at least an entry for pg_database. - */ - RelationCacheInitializePhase2(); - - /* * Set up the global variables holding database id and default tablespace. * But note we won't actually try to touch the database just yet. * diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index 66904e6b09..03e2408737 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -10,7 +10,7 @@ * Written by Peter Eisentraut <peter_e@gmx.net>. * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.513 2009/08/31 02:23:22 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.514 2009/08/31 19:41:00 tgl Exp $ * *-------------------------------------------------------------------- */ @@ -1335,7 +1335,7 @@ static struct config_int ConfigureNamesInt[] = * Note: MaxBackends is limited to INT_MAX/4 because some places compute * 4*MaxBackends without any overflow check. This check is made in * assign_maxconnections, since MaxBackends is computed as MaxConnections - * plus autovacuum_max_workers. + * plus autovacuum_max_workers plus one (for the autovacuum launcher). * * Likewise we have to limit NBuffers to INT_MAX/2. */ @@ -7570,11 +7570,11 @@ show_tcp_keepalives_count(void) static bool assign_maxconnections(int newval, bool doit, GucSource source) { - if (newval + autovacuum_max_workers > INT_MAX / 4) + if (newval + autovacuum_max_workers + 1 > INT_MAX / 4) return false; if (doit) - MaxBackends = newval + autovacuum_max_workers; + MaxBackends = newval + autovacuum_max_workers + 1; return true; } @@ -7582,11 +7582,11 @@ assign_maxconnections(int newval, bool doit, GucSource source) static bool assign_autovacuum_max_workers(int newval, bool doit, GucSource source) { - if (newval + MaxConnections > INT_MAX / 4) + if (MaxConnections + newval + 1 > INT_MAX / 4) return false; if (doit) - MaxBackends = newval + MaxConnections; + MaxBackends = MaxConnections + newval + 1; return true; } |
