From: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: autovacuum launcher using InitPostgres |
Date: | 2009-08-31 16:18:55 |
Message-ID: | 20090831161855.GI6060@alvh.no-ip.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Tom Lane wrote:
> Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> > How about this?
>
> I think the accounting for the AV launcher in shmem allocation is a bit
> confused yet --- for instance, isn't MaxBackends already including the
> launcher? I wonder if it would be cleaner to include the launcher in
> the autovacuum_max_workers parameter, and increase the min/default
> values of that by one.
Huh, yeah, sorry about that -- fixed here. I think the name of the
param, which includes "worker", precludes from raising the values.
Changes between v2 and v3:
diff -u src/backend/storage/lmgr/proc.c src/backend/storage/lmgr/proc.c
--- src/backend/storage/lmgr/proc.c 31 Aug 2009 13:36:56 -0000
+++ src/backend/storage/lmgr/proc.c 31 Aug 2009 16:14:08 -0000
@@ -103,7 +103,7 @@
/* AuxiliaryProcs */
size = add_size(size, mul_size(NUM_AUXILIARY_PROCS, sizeof(PGPROC)));
/* MyProcs, including autovacuum workers and launcher */
- size = add_size(size, mul_size(MaxBackends + 1, sizeof(PGPROC)));
+ size = add_size(size, mul_size(MaxBackends, sizeof(PGPROC)));
/* ProcStructLock */
size = add_size(size, sizeof(slock_t));
@@ -192,6 +192,7 @@
ProcGlobal->freeProcs = &procs[i];
}
+ /* note: the "+1" here accounts for the autovac launcher */
procs = (PGPROC *) ShmemAlloc((autovacuum_max_workers + 1) * sizeof(PGPROC));
if (!procs)
ereport(FATAL,
diff -u src/backend/utils/misc/guc.c src/backend/utils/misc/guc.c
--- src/backend/utils/misc/guc.c 31 Aug 2009 03:07:47 -0000
+++ src/backend/utils/misc/guc.c 31 Aug 2009 16:12:56 -0000
@@ -7570,7 +7570,7 @@
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)
--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
Attachment | Content-Type | Size |
---|---|---|
avlauncher-proc-3.patch | text/x-diff | 16.7 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2009-08-31 16:34:09 | Re: autovacuum launcher using InitPostgres |
Previous Message | Tom Lane | 2009-08-31 16:15:20 | Re: autovacuum launcher using InitPostgres |