Skip to content

Commit 6201fa3

Browse files
committed
Rename debug_invalidate_system_caches_always to debug_discard_caches.
The name introduced by commit 4656e3d was agreed to be unreasonably long. To match this change, rename initdb's recently-added --clobber-cache option to --discard-caches. Discussion: https://postgr.es/m/1374320.1625430433@sss.pgh.pa.us
1 parent a92709f commit 6201fa3

File tree

20 files changed

+97
-100
lines changed

20 files changed

+97
-100
lines changed

contrib/postgres_fdw/expected/postgres_fdw.out

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9340,11 +9340,11 @@ WARNING: there is no transaction in progress
93409340
-- Change application_name of remote connection to special one
93419341
-- so that we can easily terminate the connection later.
93429342
ALTER SERVER loopback OPTIONS (application_name 'fdw_retry_check');
9343-
-- If debug_invalidate_system_caches_always is active, it results in
9343+
-- If debug_discard_caches is active, it results in
93449344
-- dropping remote connections after every transaction, making it
93459345
-- impossible to test termination meaningfully. So turn that off
93469346
-- for this test.
9347-
SET debug_invalidate_system_caches_always = 0;
9347+
SET debug_discard_caches = 0;
93489348
-- Make sure we have a remote connection.
93499349
SELECT 1 FROM ft1 LIMIT 1;
93509350
?column?
@@ -9386,7 +9386,7 @@ SELECT 1 FROM ft1 LIMIT 1; -- should fail
93869386
ERROR: 08006
93879387
\set VERBOSITY default
93889388
COMMIT;
9389-
RESET debug_invalidate_system_caches_always;
9389+
RESET debug_discard_caches;
93909390
-- =============================================================================
93919391
-- test connection invalidation cases and postgres_fdw_get_connections function
93929392
-- =============================================================================

contrib/postgres_fdw/sql/postgres_fdw.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2831,11 +2831,11 @@ ROLLBACK;
28312831
-- so that we can easily terminate the connection later.
28322832
ALTER SERVER loopback OPTIONS (application_name 'fdw_retry_check');
28332833

2834-
-- If debug_invalidate_system_caches_always is active, it results in
2834+
-- If debug_discard_caches is active, it results in
28352835
-- dropping remote connections after every transaction, making it
28362836
-- impossible to test termination meaningfully. So turn that off
28372837
-- for this test.
2838-
SET debug_invalidate_system_caches_always = 0;
2838+
SET debug_discard_caches = 0;
28392839

28402840
-- Make sure we have a remote connection.
28412841
SELECT 1 FROM ft1 LIMIT 1;
@@ -2861,7 +2861,7 @@ SELECT 1 FROM ft1 LIMIT 1; -- should fail
28612861
\set VERBOSITY default
28622862
COMMIT;
28632863

2864-
RESET debug_invalidate_system_caches_always;
2864+
RESET debug_discard_caches;
28652865

28662866
-- =============================================================================
28672867
-- test connection invalidation cases and postgres_fdw_get_connections function

doc/src/sgml/config.sgml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10337,10 +10337,10 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
1033710337
</listitem>
1033810338
</varlistentry>
1033910339

10340-
<varlistentry id="guc-debug-invalidate-system-caches-always" xreflabel="debug_invalidate_system_caches_always">
10341-
<term><varname>debug_invalidate_system_caches_always</varname> (<type>integer</type>)
10340+
<varlistentry id="guc-debug-discard-caches" xreflabel="debug_discard_caches">
10341+
<term><varname>debug_discard_caches</varname> (<type>integer</type>)
1034210342
<indexterm>
10343-
<primary><varname>debug_invalidate_system_caches_always</varname> configuration parameter</primary>
10343+
<primary><varname>debug_discard_caches</varname> configuration parameter</primary>
1034410344
</indexterm>
1034510345
</term>
1034610346
<listitem>
@@ -10365,7 +10365,7 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
1036510365

1036610366
<para>
1036710367
This parameter is supported when
10368-
<symbol>CLOBBER_CACHE_ENABLED</symbol> was defined at compile time
10368+
<symbol>DISCARD_CACHES_ENABLED</symbol> was defined at compile time
1036910369
(which happens automatically when using the
1037010370
<application>configure</application> option
1037110371
<option>--enable-cassert</option>). In production builds, its value

doc/src/sgml/ref/initdb.sgml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -388,17 +388,6 @@ PostgreSQL documentation
388388
Other, less commonly used, options are also available:
389389

390390
<variablelist>
391-
<varlistentry>
392-
<term><option>--clobber-cache</option></term>
393-
<listitem>
394-
<para>
395-
Run the bootstrap backend with the
396-
<literal>debug_invalidate_system_caches_always=1</literal> option.
397-
This takes a very long time and is only of use for deep debugging.
398-
</para>
399-
</listitem>
400-
</varlistentry>
401-
402391
<varlistentry>
403392
<term><option>-d</option></term>
404393
<term><option>--debug</option></term>
@@ -413,6 +402,17 @@ PostgreSQL documentation
413402
</listitem>
414403
</varlistentry>
415404

405+
<varlistentry>
406+
<term><option>--discard-caches</option></term>
407+
<listitem>
408+
<para>
409+
Run the bootstrap backend with the
410+
<literal>debug_discard_caches=1</literal> option.
411+
This takes a very long time and is only of use for deep debugging.
412+
</para>
413+
</listitem>
414+
</varlistentry>
415+
416416
<varlistentry>
417417
<term><option>-L <replaceable class="parameter">directory</replaceable></option></term>
418418
<listitem>

doc/src/sgml/regress.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ make check EXTRA_REGRESS_OPTS="--temp-config=test_postgresql.conf"
373373
<para>
374374
This can be useful to enable additional logging, adjust resource limits,
375375
or enable extra run-time checks such as <xref
376-
linkend="guc-debug-invalidate-system-caches-always"/>.
376+
linkend="guc-debug-discard-caches"/>.
377377
</para>
378378
</sect2>
379379

doc/src/sgml/release-14.sgml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3606,13 +3606,12 @@ Author: Peter Eisentraut <peter@eisentraut.org>
36063606
-->
36073607

36083608
<para>
3609-
Add <xref linkend="guc-debug-invalidate-system-caches-always"/>
3610-
to control cache overwriting (Craig Ringer)
3609+
Add <xref linkend="guc-debug-discard-caches"/>
3610+
to control cache flushing for test purposes (Craig Ringer)
36113611
</para>
36123612

36133613
<para>
3614-
Previously this could only be controlled at compile time and is
3615-
enabled only in assert builds.
3614+
Previously this behavior could only be set at compile time.
36163615
</para>
36173616
</listitem>
36183617

src/backend/utils/adt/lockfuncs.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -636,10 +636,10 @@ pg_isolation_test_session_is_blocked(PG_FUNCTION_ARGS)
636636
* Check if any of these are in the list of interesting PIDs, that being
637637
* the sessions that the isolation tester is running. We don't use
638638
* "arrayoverlaps" here, because it would lead to cache lookups and one of
639-
* our goals is to run quickly with debug_invalidate_system_caches_always
640-
* > 0. We expect blocking_pids to be usually empty and otherwise a very
641-
* small number in isolation tester cases, so make that the outer loop of
642-
* a naive search for a match.
639+
* our goals is to run quickly with debug_discard_caches > 0. We expect
640+
* blocking_pids to be usually empty and otherwise a very small number in
641+
* isolation tester cases, so make that the outer loop of a naive search
642+
* for a match.
643643
*/
644644
for (i = 0; i < num_blocking_pids; i++)
645645
for (j = 0; j < num_interesting_pids; j++)

src/backend/utils/cache/inval.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ static int numSharedInvalidMessagesArray;
181181
static int maxSharedInvalidMessagesArray;
182182

183183
/* GUC storage */
184-
int debug_invalidate_system_caches_always = 0;
184+
int debug_discard_caches = 0;
185185

186186
/*
187187
* Dynamically-registered callback functions. Current implementation
@@ -689,36 +689,36 @@ AcceptInvalidationMessages(void)
689689
ReceiveSharedInvalidMessages(LocalExecuteInvalidationMessage,
690690
InvalidateSystemCaches);
691691

692-
/*
692+
/*----------
693693
* Test code to force cache flushes anytime a flush could happen.
694694
*
695695
* This helps detect intermittent faults caused by code that reads a cache
696696
* entry and then performs an action that could invalidate the entry, but
697697
* rarely actually does so. This can spot issues that would otherwise
698698
* only arise with badly timed concurrent DDL, for example.
699699
*
700-
* The default debug_invalidate_system_caches_always = 0 does no forced
701-
* cache flushes.
700+
* The default debug_discard_caches = 0 does no forced cache flushes.
702701
*
703702
* If used with CLOBBER_FREED_MEMORY,
704-
* debug_invalidate_system_caches_always = 1 (CLOBBER_CACHE_ALWAYS)
703+
* debug_discard_caches = 1 (formerly known as CLOBBER_CACHE_ALWAYS)
705704
* provides a fairly thorough test that the system contains no cache-flush
706705
* hazards. However, it also makes the system unbelievably slow --- the
707706
* regression tests take about 100 times longer than normal.
708707
*
709708
* If you're a glutton for punishment, try
710-
* debug_invalidate_system_caches_always = 3 (CLOBBER_CACHE_RECURSIVELY).
709+
* debug_discard_caches = 3 (formerly known as CLOBBER_CACHE_RECURSIVELY).
711710
* This slows things by at least a factor of 10000, so I wouldn't suggest
712711
* trying to run the entire regression tests that way. It's useful to try
713712
* a few simple tests, to make sure that cache reload isn't subject to
714713
* internal cache-flush hazards, but after you've done a few thousand
715714
* recursive reloads it's unlikely you'll learn more.
715+
*----------
716716
*/
717-
#ifdef CLOBBER_CACHE_ENABLED
717+
#ifdef DISCARD_CACHES_ENABLED
718718
{
719719
static int recursion_depth = 0;
720720

721-
if (recursion_depth < debug_invalidate_system_caches_always)
721+
if (recursion_depth < debug_discard_caches)
722722
{
723723
recursion_depth++;
724724
InvalidateSystemCaches();

src/backend/utils/cache/plancache.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -897,9 +897,8 @@ BuildCachedPlan(CachedPlanSource *plansource, List *qlist,
897897
* rejected a generic plan, it's possible to reach here with is_valid
898898
* false due to an invalidation while making the generic plan. In theory
899899
* the invalidation must be a false positive, perhaps a consequence of an
900-
* sinval reset event or the debug_invalidate_system_caches_always code.
901-
* But for safety, let's treat it as real and redo the
902-
* RevalidateCachedQuery call.
900+
* sinval reset event or the debug_discard_caches code. But for safety,
901+
* let's treat it as real and redo the RevalidateCachedQuery call.
903902
*/
904903
if (!plansource->is_valid)
905904
qlist = RevalidateCachedQuery(plansource, queryEnv);

src/backend/utils/cache/relcache.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
#define MAYBE_RECOVER_RELATION_BUILD_MEMORY 1
9898
#else
9999
#define RECOVER_RELATION_BUILD_MEMORY 0
100-
#ifdef CLOBBER_CACHE_ENABLED
100+
#ifdef DISCARD_CACHES_ENABLED
101101
#define MAYBE_RECOVER_RELATION_BUILD_MEMORY 1
102102
#endif
103103
#endif
@@ -1011,10 +1011,10 @@ RelationBuildDesc(Oid targetRelId, bool insertIt)
10111011
* data, reasoning that the caller's context is at worst of transaction
10121012
* scope, and relcache loads shouldn't happen so often that it's essential
10131013
* to recover transient data before end of statement/transaction. However
1014-
* that's definitely not true in clobber-cache test builds, and perhaps
1015-
* it's not true in other cases.
1014+
* that's definitely not true when debug_discard_caches is active, and
1015+
* perhaps it's not true in other cases.
10161016
*
1017-
* When cache clobbering is enabled or when forced to by
1017+
* When debug_discard_caches is active or when forced to by
10181018
* RECOVER_RELATION_BUILD_MEMORY=1, arrange to allocate the junk in a
10191019
* temporary context that we'll free before returning. Make it a child of
10201020
* caller's context so that it will get cleaned up appropriately if we
@@ -1024,7 +1024,7 @@ RelationBuildDesc(Oid targetRelId, bool insertIt)
10241024
MemoryContext tmpcxt = NULL;
10251025
MemoryContext oldcxt = NULL;
10261026

1027-
if (RECOVER_RELATION_BUILD_MEMORY || debug_invalidate_system_caches_always > 0)
1027+
if (RECOVER_RELATION_BUILD_MEMORY || debug_discard_caches > 0)
10281028
{
10291029
tmpcxt = AllocSetContextCreate(CurrentMemoryContext,
10301030
"RelationBuildDesc workspace",
@@ -1627,11 +1627,10 @@ LookupOpclassInfo(Oid operatorClassOid,
16271627
* otherwise. However it can be helpful for detecting bugs in the cache
16281628
* loading logic itself, such as reliance on a non-nailed index. Given
16291629
* the limited use-case and the fact that this adds a great deal of
1630-
* expense, we enable it only for high values of
1631-
* debug_invalidate_system_caches_always.
1630+
* expense, we enable it only for high values of debug_discard_caches.
16321631
*/
1633-
#ifdef CLOBBER_CACHE_ENABLED
1634-
if (debug_invalidate_system_caches_always > 2)
1632+
#ifdef DISCARD_CACHES_ENABLED
1633+
if (debug_discard_caches > 2)
16351634
opcentry->valid = false;
16361635
#endif
16371636

0 commit comments

Comments
 (0)