pgsql: Allow background workers to be started dynamically.

Поиск
Список
Период
Сортировка
От Robert Haas
Тема pgsql: Allow background workers to be started dynamically.
Дата
Msg-id E1Uz8eF-0006OE-Bb@gemulon.postgresql.org
обсуждение исходный текст
Ответы Re: pgsql: Allow background workers to be started dynamically.  (Andres Freund <andres@2ndquadrant.com>)
Список pgsql-committers
Allow background workers to be started dynamically.

There is a new API, RegisterDynamicBackgroundWorker, which allows
an ordinary user backend to register a new background writer during
normal running.  This means that it's no longer necessary for all
background workers to be registered during processing of
shared_preload_libraries, although the option of registering workers
at that time remains available.

When a background worker exits and will not be restarted, the
slot previously used by that background worker is automatically
released and becomes available for reuse.  Slots used by background
workers that are configured for automatic restart can't (yet) be
released without shutting down the system.

This commit adds a new source file, bgworker.c, and moves some
of the existing control logic for background workers there.
Previously, there was little enough logic that it made sense to
keep everything in postmaster.c, but not any more.

This commit also makes the worker_spi contrib module into an
extension and adds a new function, worker_spi_launch, which can
be used to demonstrate the new facility.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/7f7485a0cde92aa4ba235a1ffe4dda0ca0b6cc9a

Modified Files
--------------
contrib/worker_spi/Makefile                 |    3 +
contrib/worker_spi/worker_spi--1.0.sql      |    9 +
contrib/worker_spi/worker_spi.c             |   66 +++-
contrib/worker_spi/worker_spi.control       |    5 +
doc/src/sgml/bgworker.sgml                  |   55 ++-
src/backend/postmaster/Makefile             |    4 +-
src/backend/postmaster/bgworker.c           |  483 +++++++++++++++++++++++++++
src/backend/postmaster/postmaster.c         |  227 +++----------
src/backend/storage/ipc/ipci.c              |    3 +
src/include/postmaster/bgworker.h           |   14 +-
src/include/postmaster/bgworker_internals.h |   48 +++
src/include/storage/lwlock.h                |    1 +
src/include/storage/pmsignal.h              |    1 +
13 files changed, 710 insertions(+), 209 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: pgsql: Fix PQconninfoParse error message handling
Следующее
От: Kevin Grittner
Дата:
Сообщение: pgsql: Add support for REFRESH MATERIALIZED VIEW CONCURRENTLY.