From: Andres Freund <andres@anarazel.de>
To: pgsql-committers@postgresql.org
Subject: pgsql: Don't include low level locking code from frontend code.
Date: Fri, 07 Aug 2015 13:13:44 +0000
Message-ID: <E1ZNhSy-0006zU-35@gemulon.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>
Don't include low level locking code from frontend code.
Some frontend code like e.g. pg_xlogdump or pg_resetxlog, has to use
backend headers. Unfortunately until now that code includes most of the
locking code. It's generally not nice to expose such low level details,
but de6fd1c898 made that a hard problem. We fall back to defining
'inline' away if the compiler doesn't support it - that can cause linker
errors like on buildfarm animal pademelon if a inline function
references backend only code.
To fix that problem separate definitions from lock.h that are required
from frontend code into lockdefs.h and use it in the relevant
places. I've only removed the minimal amount of necessary definitions
for now - it might turn out that we want more for other reasons.
To avoid such details being exposed again put some checks against being
included from frontend code into atomics.h, lock.h, lwlock.h and
s_lock.h. It's otherwise fairly easy to indirectly include these
headers.
Discussion: 20150806070902.GE12214@awork2.anarazel.de
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/4eda0a64705763854225a29703b606692af50e77
Modified Files
--------------
src/backend/utils/hash/hashfn.c | 1 +
src/include/access/genam.h | 2 +-
src/include/access/hash.h | 2 +-
src/include/access/tuptoaster.h | 2 +-
src/include/catalog/objectaddress.h | 2 +-
src/include/port/atomics.h | 4 +++
src/include/storage/lock.h | 43 ++++-----------------------
src/include/storage/lockdefs.h | 56 +++++++++++++++++++++++++++++++++++
src/include/storage/lwlock.h | 4 +++
src/include/storage/procarray.h | 1 +
src/include/storage/s_lock.h | 4 +++
src/include/storage/standby.h | 2 +-
12 files changed, 80 insertions(+), 43 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: Don't include low level locking code from frontend code.
In-Reply-To: <E1ZNhSy-0006zU-35@gemulon.postgresql.org>
References: <E1ZNhSy-0006zU-35@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