postgresql/src/backend
Tom Lane 9753324b7d 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
..
access Use InvalidBucket instead of -1 where appropriate 2021-07-02 11:59:55 +02:00
bootstrap Rethink definition of pg_attribute.attcompression. 2021-05-27 13:24:27 -04:00
catalog genbki stricter error handling 2021-06-30 08:50:26 +02:00
commands Don't reset relhasindex for partitioned tables on ANALYZE 2021-07-01 12:56:30 -04:00
executor Cleanup some aggregate code in the executor 2021-07-04 18:47:31 +12:00
foreign Update copyright for 2021 2021-01-02 13:06:25 -05:00
jit Prepare for forthcoming LLVM 13 API change. 2021-06-25 11:28:20 +12:00
lib Fix typo in comment 2021-04-20 14:35:16 +02:00
libpq Don't assume GSSAPI result strings are null-terminated. 2021-06-23 14:01:32 -04:00
main Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodes Reconsider the handling of procedure OUT parameters. 2021-06-10 17:11:36 -04:00
optimizer Reconsider the handling of procedure OUT parameters. 2021-06-10 17:11:36 -04:00
parser Cleanup some aggregate code in the executor 2021-07-04 18:47:31 +12:00
partitioning Fix bogus logic for reporting which hash partition conflicts. 2021-06-29 14:34:31 -04:00
po Translation updates 2021-06-21 12:33:50 +02:00
port Initial pgindent and pgperltidy run for v14. 2021-05-12 13:14:10 -04:00
postmaster Message style improvements 2021-06-28 08:36:44 +02:00
regex Fix performance issue in new regex match-all detection code. 2021-05-03 11:42:31 -04:00
replication Don't try to print data type names in slot_store_error_callback(). 2021-07-02 16:04:54 -04:00
rewrite Adjust locations which have an incorrect copyright year 2021-06-04 12:19:50 +12:00
snowball Update snowball 2021-02-19 08:10:15 +01:00
statistics Error message refactoring 2021-06-27 09:41:16 +02:00
storage Remove some dead stores. 2021-07-02 13:32:21 +12:00
tcop Message style improvements 2021-06-28 08:36:44 +02:00
tsearch Improve various places that double the size of a buffer 2021-07-01 15:29:06 +12:00
utils Reduce overhead of cache-clobber testing in LookupOpclassInfo(). 2021-07-05 16:51:57 -04:00
.gitignore
Makefile Use sort_template.h for qsort_tuple() and qsort_ssup(). 2021-03-03 17:02:32 +13:00
common.mk Remove PARTIAL_LINKING build mode. 2018-03-30 17:33:04 -07:00
nls.mk Translation updates 2021-05-10 14:36:21 +02:00