]> granicus.if.org Git - postgresql/commit
Don't include low level locking code from frontend code.
authorAndres Freund <andres@anarazel.de>
Fri, 7 Aug 2015 13:10:56 +0000 (15:10 +0200)
committerAndres Freund <andres@anarazel.de>
Fri, 7 Aug 2015 13:10:56 +0000 (15:10 +0200)
commit4eda0a64705763854225a29703b606692af50e77
tree286ea4d00654b603355314b130b10ccbf982790c
parent18e8613564bf0a675d453eec1fceded7bce09988
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
12 files changed:
src/backend/utils/hash/hashfn.c
src/include/access/genam.h
src/include/access/hash.h
src/include/access/tuptoaster.h
src/include/catalog/objectaddress.h
src/include/port/atomics.h
src/include/storage/lock.h
src/include/storage/lockdefs.h [new file with mode: 0644]
src/include/storage/lwlock.h
src/include/storage/procarray.h
src/include/storage/s_lock.h
src/include/storage/standby.h