pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Replace CLOBBER_CACHE_ALWAYS with run-time GUC
Date: Wed, 06 Jan 2021 09:53:18 +0000
Message-ID: <E1kx5VG-0007dn-M0@gemulon.postgresql.org> (raw)

Replace CLOBBER_CACHE_ALWAYS with run-time GUC

Forced cache invalidation (CLOBBER_CACHE_ALWAYS) has been impractical
to use for testing in PostgreSQL because it's so slow and because it's
toggled on/off only at build time.  It is helpful when hunting bugs in
any code that uses the sycache/relcache because causes cache
invalidations to be injected whenever it would be possible for an
invalidation to occur, whether or not one was really pending.

Address this by providing run-time control over cache clobber
behaviour using the new debug_invalidate_system_caches_always GUC.
Support is not compiled in at all unless assertions are enabled or
CLOBBER_CACHE_ENABLED is explicitly defined at compile time.  It
defaults to 0 if compiled in, so it has negligible effect on assert
build performance by default.

When support is compiled in, test code can now set
debug_invalidate_system_caches_always=1 locally to a backend to test
specific queries, functions, extensions, etc.  Or tests can toggle it
globally for a specific test case while retaining normal performance
during test setup and teardown.

For backwards compatibility with existing test harnesses and scripts,
debug_invalidate_system_caches_always defaults to 1 if
CLOBBER_CACHE_ALWAYS is defined, and to 3 if CLOBBER_CACHE_RECURSIVE
is defined.

CLOBBER_CACHE_ENABLED is now visible in pg_config_manual.h, as is the
related RECOVER_RELATION_BUILD_MEMORY setting for the relcache.

Author: Craig Ringer <craig.ringer@2ndquadrant.com>
Discussion: https://www.postgresql.org/message-id/flat/CAMsr+YF=+ctXBZj3ywmvKNUjWpxmuTuUKuv-rgbHGX5i5pLstQ@mail....

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4656e3d66893f286767285cf74dabb3877068e49

Modified Files
--------------
doc/src/sgml/config.sgml            | 37 ++++++++++++++++++++
doc/src/sgml/regress.sgml           |  3 +-
src/backend/utils/adt/lockfuncs.c   |  2 +-
src/backend/utils/cache/inval.c     | 48 +++++++++++++-------------
src/backend/utils/cache/plancache.c |  2 +-
src/backend/utils/cache/relcache.c  | 67 ++++++++++++++++++++++---------------
src/backend/utils/misc/guc.c        | 24 +++++++++++++
src/include/pg_config_manual.h      | 39 +++++++++++++++++++++
src/include/utils/inval.h           |  1 +
9 files changed, 169 insertions(+), 54 deletions(-)



Message-ID: <E1kx5VG-0007dn-M0@gemulon.postgresql.org>
Permalink:  ../E1kx5VG-0007dn-M0@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1kx5VG-0007dn-M0@gemulon.postgresql.org

 · 

reply

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: peter@eisentraut.org
  Subject: Re: pgsql: Replace CLOBBER_CACHE_ALWAYS with run-time GUC
  In-Reply-To: <E1kx5VG-0007dn-M0@gemulon.postgresql.org>
  References: <E1kx5VG-0007dn-M0@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