From: Andres Freund <andres@anarazel.de>
To: pgsql-committers@postgresql.org
Subject: pgsql: Add a default local latch for use in signal handlers.
Date: Wed, 14 Jan 2015 17:53:13 +0000
Message-ID: <E1YBS81-0001yI-TQ@gemulon.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>
Add a default local latch for use in signal handlers.
To do so, move InitializeLatchSupport() into the new common process
initialization functions, and add a new global variable MyLatch.
MyLatch is usable as soon InitPostmasterChild() has been called
(i.e. very early during startup). Initially it points to a process
local latch that exists in all processes. InitProcess/InitAuxiliaryProcess
then replaces that local latch with PGPROC->procLatch. During shutdown
the reverse happens.
This is primarily advantageous for two reasons: For one it simplifies
dealing with the shared process latch, especially in signal handlers,
because instead of having to check for MyProc, MyLatch can be used
unconditionally. For another, a later patch that makes FEs/BE
communication use latches, now can rely on the existence of a latch,
even before having gone through InitProcess.
Discussion: 20140927191243.GD5423@alap3.anarazel.de
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/59f71a0d0b56b2df48db4bf1738aece5551f7a47
Modified Files
--------------
src/backend/postmaster/autovacuum.c | 13 ++++-----
src/backend/postmaster/bgworker.c | 4 +--
src/backend/postmaster/bgwriter.c | 12 ++++-----
src/backend/postmaster/checkpointer.c | 13 ++++-----
src/backend/postmaster/pgarch.c | 21 +++++----------
src/backend/postmaster/pgstat.c | 19 +++++---------
src/backend/postmaster/syslogger.c | 21 +++++----------
src/backend/postmaster/walwriter.c | 10 +++----
src/backend/replication/syncrep.c | 4 +--
src/backend/storage/ipc/procsignal.c | 4 +--
src/backend/storage/ipc/shm_mq.c | 12 ++++-----
src/backend/storage/lmgr/proc.c | 42 +++++++++++++-----------------
src/backend/tcop/postgres.c | 12 +++------
src/backend/utils/adt/misc.c | 4 +--
src/backend/utils/init/globals.c | 9 +++++++
src/backend/utils/init/miscinit.c | 37 ++++++++++++++++++++++++++
src/backend/utils/misc/timeout.c | 6 ++---
src/include/miscadmin.h | 4 +++
src/include/storage/latch.h | 2 +-
src/test/modules/test_shm_mq/setup.c | 4 +--
src/test/modules/test_shm_mq/test.c | 4 +--
src/test/modules/test_shm_mq/worker.c | 3 +--
src/test/modules/worker_spi/worker_spi.c | 10 +++----
23 files changed, 136 insertions(+), 134 deletions(-)
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: andres@anarazel.de
Subject: Re: pgsql: Add a default local latch for use in signal handlers.
In-Reply-To: <E1YBS81-0001yI-TQ@gemulon.postgresql.org>
References: <E1YBS81-0001yI-TQ@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox