Skip to content

Commit d68a003

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 e0271d5 commit d68a003

File tree

19 files changed

+94
-96
lines changed

19 files changed

+94
-96
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
@@ -10341,10 +10341,10 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
1034110341
</listitem>
1034210342
</varlistentry>
1034310343

10344-
<varlistentry id="guc-debug-invalidate-system-caches-always" xreflabel="debug_invalidate_system_caches_always">
10345-
<term><varname>debug_invalidate_system_caches_always</varname> (<type>integer</type>)
10344+
<varlistentry id="guc-debug-discard-caches" xreflabel="debug_discard_caches">
10345+
<term><varname>debug_discard_caches</varname> (<type>integer</type>)
1034610346
<indexterm>
10347-
<primary><varname>debug_invalidate_system_caches_always</varname> configuration parameter</primary>
10347+
<primary><varname>debug_discard_caches</varname> configuration parameter</primary>
1034810348
</indexterm>
1034910349
</term>
1035010350
<listitem>
@@ -10369,7 +10369,7 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
1036910369

1037010370
<para>
1037110371
This parameter is supported when
10372-
<symbol>CLOBBER_CACHE_ENABLED</symbol> was defined at compile time
10372+
<symbol>DISCARD_CACHES_ENABLED</symbol> was defined at compile time
1037310373
(which happens automatically when using the
1037410374
<application>configure</application> option
1037510375
<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

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
@@ -182,7 +182,7 @@ static int numSharedInvalidMessagesArray;
182182
static int maxSharedInvalidMessagesArray;
183183

184184
/* GUC storage */
185-
int debug_invalidate_system_caches_always = 0;
185+
int debug_discard_caches = 0;
186186

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

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

722-
if (recursion_depth < debug_invalidate_system_caches_always)
722+
if (recursion_depth < debug_discard_caches)
723723
{
724724
recursion_depth++;
725725
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

src/backend/utils/misc/guc.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3513,13 +3513,13 @@ static struct config_int ConfigureNamesInt[] =
35133513
},
35143514

35153515
{
3516-
{"debug_invalidate_system_caches_always", PGC_SUSET, DEVELOPER_OPTIONS,
3517-
gettext_noop("Aggressively invalidate system caches for debugging purposes."),
3516+
{"debug_discard_caches", PGC_SUSET, DEVELOPER_OPTIONS,
3517+
gettext_noop("Aggressively flush system caches for debugging purposes."),
35183518
NULL,
35193519
GUC_NOT_IN_SAMPLE
35203520
},
3521-
&debug_invalidate_system_caches_always,
3522-
#ifdef CLOBBER_CACHE_ENABLED
3521+
&debug_discard_caches,
3522+
#ifdef DISCARD_CACHES_ENABLED
35233523
/* Set default based on older compile-time-only cache clobber macros */
35243524
#if defined(CLOBBER_CACHE_RECURSIVELY)
35253525
3,
@@ -3529,9 +3529,9 @@ static struct config_int ConfigureNamesInt[] =
35293529
0,
35303530
#endif
35313531
0, 5,
3532-
#else /* not CLOBBER_CACHE_ENABLED */
3532+
#else /* not DISCARD_CACHES_ENABLED */
35333533
0, 0, 0,
3534-
#endif /* not CLOBBER_CACHE_ENABLED */
3534+
#endif /* not DISCARD_CACHES_ENABLED */
35353535
NULL, NULL, NULL
35363536
},
35373537

src/bin/initdb/initdb.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2266,8 +2266,8 @@ usage(const char *progname)
22662266
printf(_(" -X, --waldir=WALDIR location for the write-ahead log directory\n"));
22672267
printf(_(" --wal-segsize=SIZE size of WAL segments, in megabytes\n"));
22682268
printf(_("\nLess commonly used options:\n"));
2269-
printf(_(" --clobber-cache use cache-clobbering debug option\n"));
22702269
printf(_(" -d, --debug generate lots of debugging output\n"));
2270+
printf(_(" --discard-caches set debug_discard_caches=1\n"));
22712271
printf(_(" -L DIRECTORY where to find the input files\n"));
22722272
printf(_(" -n, --no-clean do not clean up after errors\n"));
22732273
printf(_(" -N, --no-sync do not wait for changes to be written safely to disk\n"));
@@ -2947,7 +2947,7 @@ main(int argc, char *argv[])
29472947
{"wal-segsize", required_argument, NULL, 12},
29482948
{"data-checksums", no_argument, NULL, 'k'},
29492949
{"allow-group-access", no_argument, NULL, 'g'},
2950-
{"clobber-cache", no_argument, NULL, 14},
2950+
{"discard-caches", no_argument, NULL, 14},
29512951
{NULL, 0, NULL, 0}
29522952
};
29532953

@@ -3092,7 +3092,7 @@ main(int argc, char *argv[])
30923092
case 14:
30933093
extra_options = psprintf("%s %s",
30943094
extra_options,
3095-
"-c debug_invalidate_system_caches_always=1");
3095+
"-c debug_discard_caches=1");
30963096
break;
30973097
default:
30983098
/* getopt_long already emitted a complaint */

src/include/pg_config_manual.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -322,36 +322,36 @@
322322
/* #define RANDOMIZE_ALLOCATED_MEMORY */
323323

324324
/*
325-
* For cache invalidation debugging, define CLOBBER_CACHE_ENABLED to enable
326-
* use of the debug_invalidate_system_caches_always GUC to aggressively flush
327-
* syscache/relcache entries whenever it's possible to deliver invalidations.
328-
* See AcceptInvalidationMessages() in src/backend/utils/cache/inval.c for
325+
* For cache-invalidation debugging, define DISCARD_CACHES_ENABLED to enable
326+
* use of the debug_discard_caches GUC to aggressively flush syscache/relcache
327+
* entries whenever it's possible to deliver invalidations. See
328+
* AcceptInvalidationMessages() in src/backend/utils/cache/inval.c for
329329
* details.
330330
*
331331
* USE_ASSERT_CHECKING builds default to enabling this. It's possible to use
332-
* CLOBBER_CACHE_ENABLED without a cassert build and the implied
333-
* CLOBBER_FREED_MEMORY and MEMORY_CONTEXT_CHECKING options but it's unlikely
332+
* DISCARD_CACHES_ENABLED without a cassert build and the implied
333+
* CLOBBER_FREED_MEMORY and MEMORY_CONTEXT_CHECKING options, but it's unlikely
334334
* to be as effective at identifying problems.
335335
*/
336-
/* #define CLOBBER_CACHE_ENABLED */
336+
/* #define DISCARD_CACHES_ENABLED */
337337

338-
#if defined(USE_ASSERT_CHECKING) && !defined(CLOBBER_CACHE_ENABLED)
339-
#define CLOBBER_CACHE_ENABLED
338+
#if defined(USE_ASSERT_CHECKING) && !defined(DISCARD_CACHES_ENABLED)
339+
#define DISCARD_CACHES_ENABLED
340340
#endif
341341

342342
/*
343-
* Backwards compatibility for the older compile-time-only cache clobber
343+
* Backwards compatibility for the older compile-time-only clobber-cache
344344
* macros.
345345
*/
346-
#if !defined(CLOBBER_CACHE_ENABLED) && (defined(CLOBBER_CACHE_ALWAYS) || defined(CLOBBER_CACHE_RECURSIVELY))
347-
#define CLOBBER_CACHE_ENABLED
346+
#if !defined(DISCARD_CACHES_ENABLED) && (defined(CLOBBER_CACHE_ALWAYS) || defined(CLOBBER_CACHE_RECURSIVELY))
347+
#define DISCARD_CACHES_ENABLED
348348
#endif
349349

350350
/*
351351
* Recover memory used for relcache entries when invalidated. See
352352
* RelationBuildDescr() in src/backend/utils/cache/relcache.c.
353353
*
354-
* This is active automatically for clobber cache builds when clobbering is
354+
* This is active automatically for clobber-cache builds when clobbering is
355355
* active, but can be overridden here by explicitly defining
356356
* RECOVER_RELATION_BUILD_MEMORY. Define to 1 to always free relation cache
357357
* memory even when clobber is off, or to 0 to never free relation cache

src/include/utils/inval.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include "storage/relfilenode.h"
1919
#include "utils/relcache.h"
2020

21-
extern PGDLLIMPORT int debug_invalidate_system_caches_always;
21+
extern PGDLLIMPORT int debug_discard_caches;
2222

2323
typedef void (*SyscacheCallbackFunction) (Datum arg, int cacheid, uint32 hashvalue);
2424
typedef void (*RelcacheCallbackFunction) (Datum arg, Oid relid);

src/pl/plpgsql/src/expected/plpgsql_cache.out

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
--
44
-- These tests logically belong in plpgsql_record.sql, and perhaps someday
55
-- can be merged back into it. For now, however, their results are different
6-
-- depending on debug_invalidate_system_caches_always, so we must have two
7-
-- expected-output files to cover both cases. To minimize the maintenance
8-
-- effort resulting from that, this file should contain only tests that
9-
-- do have different results under debug_invalidate_system_caches_always.
6+
-- depending on debug_discard_caches, so we must have two expected-output
7+
-- files to cover both cases. To minimize the maintenance effort resulting
8+
-- from that, this file should contain only tests that do have different
9+
-- results under debug_discard_caches.
1010
--
1111
-- check behavior with changes of a named rowtype
1212
create table c_mutable(f1 int, f2 text);
@@ -21,7 +21,7 @@ select c_sillyaddone(42);
2121
alter table c_mutable drop column f1;
2222
alter table c_mutable add column f1 float8;
2323
-- currently, this fails due to cached plan for "r.f1 + 1" expression
24-
-- (but if debug_invalidate_system_caches_always is on, it will succeed)
24+
-- (but if debug_discard_caches is on, it will succeed)
2525
select c_sillyaddone(42);
2626
ERROR: type of parameter 4 (double precision) does not match that when preparing the plan (integer)
2727
CONTEXT: PL/pgSQL function c_sillyaddone(integer) line 1 at RETURN
@@ -52,7 +52,7 @@ select show_result_type('select 1 as a');
5252
(1 row)
5353

5454
-- currently this fails due to cached plan for pg_typeof expression
55-
-- (but if debug_invalidate_system_caches_always is on, it will succeed)
55+
-- (but if debug_discard_caches is on, it will succeed)
5656
select show_result_type('select 2.0 as a');
5757
ERROR: type of parameter 5 (numeric) does not match that when preparing the plan (integer)
5858
CONTEXT: SQL statement "select pg_typeof(r.a)"

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy