postgresql/src/include/utils
Tom Lane 5069017fec Remove AtEOXact_CatCache().
The sole useful effect of this function, to check that no catcache
entries have positive refcounts at transaction end, has really been
obsolete since we introduced ResourceOwners in PG 8.1.  We reduced the
checks to assertions years ago, so that the function was a complete
no-op in production builds.  There have been previous discussions about
removing it entirely, but consensus up to now was that it had some small
value as a cross-check for bugs in the ResourceOwner logic.

However, it now emerges that it's possible to trigger these assertions
if you hit an assert-enabled backend with SIGTERM during a call to
SearchCatCacheList, because that function temporarily increases the
refcounts of entries it's intending to add to a catcache list construct.
In a normal ERROR scenario, the extra refcounts are cleaned up by
SearchCatCacheList's PG_CATCH block; but in a FATAL exit we do a
transaction abort and exit without ever executing PG_CATCH handlers.

There's a case to be made that this is a generic hazard and we should
consider restructuring elog(FATAL) handling so that pending PG_CATCH
handlers do get run.  That's pretty scary though: it could easily create
more problems than it solves.  Preliminary stress testing by Andreas
Seltenreich suggests that there are not many live problems of this ilk,
so we rejected that idea.

There are more-localized ways to fix the problem; the most principled
one would be to use PG_ENSURE_ERROR_CLEANUP instead of plain PG_TRY.
But adding cycles to SearchCatCacheList isn't very appealing.  We could
also weaken the assertions in AtEOXact_CatCache in some more or less
ad-hoc way, but that just makes its raison d'etre even less compelling.
In the end, the most reasonable solution seems to be to just remove
AtEOXact_CatCache altogether, on the grounds that it's not worth trying
to fix it.  It hasn't found any bugs for us in many years.

Per report from Jeevan Chalke.  Back-patch to all supported branches.

Discussion: https://postgr.es/m/CAM2+6=VEE30YtRQCZX7_sCFsEpoUkFBV1gZazL70fqLn8rcvBA@mail.gmail.com
2017-08-13 16:15:14 -04:00
..
.gitignore Avoid maintaining three separate copies of the error codes list. 2011-02-03 22:32:49 -05:00
acl.h Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
array.h Collect and use element-frequency statistics for arrays. 2012-03-03 20:20:57 -05:00
ascii.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
attoptcache.h Fix include-guard 2013-07-07 13:38:47 +02:00
builtins.h Fix GiST index build for NaN values in geometric types. 2016-07-14 18:46:00 -04:00
bytea.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
cash.h Add casts from int4 and int8 to numeric. 2011-04-05 09:35:43 -04:00
catcache.h Remove AtEOXact_CatCache(). 2017-08-13 16:15:14 -04:00
combocid.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
date.h Add transform functions for various temporal typmod coercisions. 2012-02-08 09:33:37 -05:00
datetime.h Support timezone abbreviations that sometimes change. 2014-10-16 15:22:20 -04:00
datum.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
dynahash.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
dynamic_loader.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
elog.h Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
fmgrtab.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
formatting.h Fix to_char() to use ASCII-only case-folding rules where appropriate. 2013-03-05 13:02:35 -05:00
geo_decls.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
guc.h Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
guc_tables.h Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
help_config.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
hsearch.h Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
inet.h Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
int8.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
inval.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
json.h Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
logtape.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
lsyscache.h Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
memutils.h Fix bogus "out of memory" reports in tuplestore.c. 2015-08-04 18:18:46 -04:00
nabstime.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
numeric.h Remove bogus dependencies on NUMERIC_MAX_PRECISION. 2016-08-14 15:06:02 -04:00
palloc.h Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
pg_crc.h Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
pg_crc_tables.h Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
pg_locale.h Cope if platform declares mbstowcs_l(), but not locale_t, in <xlocale.h>. 2016-03-15 13:19:58 -04:00
pg_lzcompress.h Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
pg_rusage.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
plancache.h Explicitly support the case that a plancache's raw_parse_tree is NULL. 2014-11-12 15:58:47 -05:00
portal.h Fix subtransaction cleanup after an outer-subtransaction portal fails. 2015-09-04 13:36:50 -04:00
ps_status.h Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
rangetypes.h Refactor the way code is shared between some range type functions. 2012-07-18 23:15:08 +03:00
rbtree.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
rel.h Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
relcache.h Fix the logic for putting relations into the relcache init file. 2015-06-25 14:39:05 -04:00
relmapper.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
reltrigger.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
resowner.h Add a small cache of locks owned by a resource owner in ResourceOwner. 2015-08-27 12:22:10 -04:00
selfuncs.h Add security checks to selectivity estimation functions 2017-05-08 09:19:42 -04:00
snapmgr.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
snapshot.h Slightly reorganize struct SnapshotData. 2012-01-06 22:56:00 -05:00
sortsupport.h Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
spccache.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
syscache.h Use a safer method for determining whether relcache init file is stale. 2015-06-07 15:32:09 -04:00
timestamp.h Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
tqual.h Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
tuplesort.h Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
tuplestore.h Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
typcache.h Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
tzparser.h Support timezone abbreviations that sometimes change. 2014-10-16 15:22:20 -04:00
uuid.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
varbit.h Predict integer overflow to avoid buffer overruns. 2014-02-17 09:33:33 -05:00
xml.h Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00