aboutsummaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2021-01-06 10:15:19 +0100
committerPeter Eisentraut <peter@eisentraut.org>2021-01-06 10:46:44 +0100
commit4656e3d66893f286767285cf74dabb3877068e49 (patch)
treeb6ab45e6cff78f644d54c532331b7247c864f7c6 /doc/src
parent8900b5a9d59a645b3485f5b046c4c7871b2c4026 (diff)
downloadpostgresql-4656e3d66893f286767285cf74dabb3877068e49.tar.gz
postgresql-4656e3d66893f286767285cf74dabb3877068e49.zip
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.gmail.com
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/config.sgml37
-rw-r--r--doc/src/sgml/regress.sgml3
2 files changed, 39 insertions, 1 deletions
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 2a90d011db5..425f57901d7 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -9989,6 +9989,43 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
</listitem>
</varlistentry>
+ <varlistentry id="guc-debug-invalidate-system-caches-always" xreflabel="debug_invalidate_system_caches_always">
+ <term><varname>debug_invalidate_system_caches_always</varname> (<type>integer</type>)
+ <indexterm>
+ <primary><varname>debug_invalidate_system_caches_always</varname> configuration parameter</primary>
+ </indexterm>
+ </term>
+ <listitem>
+ <para>
+ When set to 1, each cache lookup for a system catalog entry is
+ invalidated at the first possible opportunity, irrespective of whether
+ anything that would render it invalid really occurred. Caching of
+ system catalogs is effectively disabled as a result, so the server
+ will run extremely slowly. Higher values run the cache invalidation
+ recursively, which is even slower and useful only useful for testing
+ in very specific scenarios.
+ </para>
+
+ <para>
+ This option can be very helpful when trying to trigger
+ hard-to-reproduce bugs involving concurrency and catalog changes but
+ is otherwise rarely needed. See the source code files
+ <filename>inval.c</filename> and
+ <filename>pg_config_manual.h</filename> for details.
+ </para>
+
+ <para>
+ This setting is supported but off by default (0) when
+ <symbol>CLOBBER_CACHE_ENABLED</symbol> is defined at compile time
+ (which happens automatically when using the
+ <literal>configure</literal> option
+ <option>--enable-cassert</option>). In production builds, its value
+ will always be <literal>0</literal> and attempts to set it to another
+ value will raise an error.
+ </para>
+ </listitem>
+ </varlistentry>
+
<varlistentry id="guc-ignore-system-indexes" xreflabel="ignore_system_indexes">
<term><varname>ignore_system_indexes</varname> (<type>boolean</type>)
<indexterm>
diff --git a/doc/src/sgml/regress.sgml b/doc/src/sgml/regress.sgml
index 890ec7c88ee..cb401a45b35 100644
--- a/doc/src/sgml/regress.sgml
+++ b/doc/src/sgml/regress.sgml
@@ -372,7 +372,8 @@ make check EXTRA_REGRESS_OPTS="--temp-config=test_postgresql.conf"
<para>
This can be useful to enable additional logging, adjust resource limits,
- or enable extra run-time checks.
+ or enable extra run-time checks such as <xref
+ linkend="guc-debug-invalidate-system-caches-always"/>.
</para>
</sect2>