postgresql/src/backend/utils/cache
Tom Lane 2f487116e9 Reduce overhead of cache-clobber testing in LookupOpclassInfo().
Commit 03ffc4d6d added logic to bypass all caching behavior in
LookupOpclassInfo when CLOBBER_CACHE_ALWAYS is enabled.  It doesn't
look like I stopped to think much about what that would cost, but
recent investigation shows that the cost is enormous: it roughly
doubles the time needed for cache-clobber test runs.

There does seem to be value in this behavior when trying to test
the opclass-cache loading logic itself, but for other purposes the
cost is excessive.  Hence, let's back off to doing this only when
debug_invalidate_system_caches_always is at least 3; or in older
branches, when CLOBBER_CACHE_RECURSIVELY is defined.

While here, clean up some other minor issues in LookupOpclassInfo.
Re-order the code so we aren't left with broken cache entries (leading
to later core dumps) in the unlikely case that we suffer OOM while
trying to allocate space for a new entry.  (That seems to be my
oversight in 03ffc4d6d.)  Also, in >= v13, stop allocating one array
entry too many.  That's evidently left over from sloppy reversion in
851b14b0c.

Back-patch to all supported branches, mainly to reduce the runtime
of cache-clobbering buildfarm animals.

Discussion: https://postgr.es/m/1370856.1625428625@sss.pgh.pa.us
2021-07-05 16:51:57 -04:00
..
attoptcache.c Update copyrights for 2020 2020-01-01 12:21:45 -05:00
catcache.c Move src/backend/utils/hash/hashfn.c to src/common 2020-02-27 09:25:41 +05:30
evtcache.c Introduce macros for typalign and typstorage constants. 2020-03-04 10:34:25 -05:00
inval.c Fix inconsistent code with shared invalidations of snapshots 2020-12-28 22:16:57 +09:00
lsyscache.c Preserve pg_attribute.attstattarget across REINDEX CONCURRENTLY 2021-02-10 13:09:09 +09:00
Makefile Split all OBJS style lines in makefiles into one-line-per-entry style. 2019-11-05 14:41:07 -08:00
partcache.c Update copyrights for 2020 2020-01-01 12:21:45 -05:00
plancache.c Allow the planner-related functions and hook to accept the query string. 2020-03-30 13:51:05 +09:00
relcache.c Reduce overhead of cache-clobber testing in LookupOpclassInfo(). 2021-07-05 16:51:57 -04:00
relfilenodemap.c Spelling adjustments 2020-06-07 15:06:51 +02:00
relmapper.c Another fix to relmapper race condition. 2021-06-24 11:19:31 +03:00
spccache.c Introduce a maintenance_io_concurrency setting. 2020-03-16 17:14:26 +13:00
syscache.c Update copyrights for 2020 2020-01-01 12:21:45 -05:00
ts_cache.c Update copyrights for 2020 2020-01-01 12:21:45 -05:00
typcache.c Fix race condition when sharing tuple descriptors. 2021-05-29 15:13:44 +12:00