pgsql: Add new GUC, max_worker_processes, limiting number of bgworkers.

Lists: pgsql-committerspgsql-hackers
From: Robert Haas <rhaas(at)postgresql(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Add new GUC, max_worker_processes, limiting number of bgworkers.
Date: 2013-07-04 15:32:18
Message-ID: E1UulW6-00049V-D5@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

Add new GUC, max_worker_processes, limiting number of bgworkers.

In 9.3, there's no particular limit on the number of bgworkers;
instead, we just count up the number that are actually registered,
and use that to set MaxBackends. However, that approach causes
problems for Hot Standby, which needs both MaxBackends and the
size of the lock table to be the same on the standby as on the
master, yet it may not be desirable to run the same bgworkers in
both places. 9.3 handles that by failing to notice the problem,
which will probably work fine in nearly all cases anyway, but is
not theoretically sound.

A further problem with simply counting the number of registered
workers is that new workers can't be registered without a
postmaster restart. This is inconvenient for administrators,
since bouncing the postmaster causes an interruption of service.
Moreover, there are a number of applications for background
processes where, by necessity, the background process must be
started on the fly (e.g. parallel query). While this patch
doesn't actually make it possible to register new background
workers after startup time, it's a necessary prerequisite.

Patch by me. Review by Michael Paquier.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/6bc8ef0b7f1f1df3998745a66e1790e27424aa0c

Modified Files
--------------
doc/src/sgml/bgworker.sgml | 5 +++
doc/src/sgml/config.sgml | 19 +++++++++
src/backend/access/rmgrdesc/xlogdesc.c | 3 +-
src/backend/access/transam/xlog.c | 8 ++++
src/backend/postmaster/postmaster.c | 54 +++----------------------
src/backend/storage/lmgr/proc.c | 6 +--
src/backend/utils/init/globals.c | 1 +
src/backend/utils/init/postinit.c | 2 +-
src/backend/utils/misc/guc.c | 28 +++++++++++--
src/backend/utils/misc/postgresql.conf.sample | 1 +
src/bin/pg_controldata/pg_controldata.c | 2 +
src/bin/pg_resetxlog/pg_resetxlog.c | 2 +
src/include/access/xlog_internal.h | 3 +-
src/include/catalog/pg_control.h | 1 +
src/include/miscadmin.h | 1 +
15 files changed, 77 insertions(+), 59 deletions(-)


From: Kevin Hale Boyes <kcboyes(at)gmail(dot)com>
To: Robert Haas <rhaas(at)postgresql(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: [COMMITTERS] pgsql: Add new GUC, max_worker_processes, limiting number of bgworkers.
Date: 2013-07-05 04:28:18
Message-ID: CADAecHVBCbKtRLoWLDiuCyRkdqWj-AKdRuzcmE8p1fZC7FTtiA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

The change to config.sgml contains a small typo with the double r in the
xreflabel.

+ <varlistentry id="guc-max-worker-processes"
xreflabel="max_worrker_processes">


From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Kevin Hale Boyes <kcboyes(at)gmail(dot)com>
Cc: Robert Haas <rhaas(at)postgresql(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [COMMITTERS] pgsql: Add new GUC, max_worker_processes, limiting number of bgworkers.
Date: 2013-07-05 14:20:05
Message-ID: CABUevEy2H22qtkVPmDBoKcR2nphMa9pxD8-i7+WpFGjXTpKYYA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

On Fri, Jul 5, 2013 at 6:28 AM, Kevin Hale Boyes <kcboyes(at)gmail(dot)com> wrote:
> The change to config.sgml contains a small typo with the double r in the
> xreflabel.
>
> + <varlistentry id="guc-max-worker-processes"
> xreflabel="max_worrker_processes">

Fixed, thanks.

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/