postgresql/src/include
Tom Lane 004a9702e0 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
..
access hash: Increase the number of possible overflow bitmaps by 8x. 2017-08-04 16:30:32 -04:00
bootstrap Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
catalog Teach map_partition_varattnos to handle whole-row expressions. 2017-08-03 11:21:29 -04:00
commands Fix transition tables for ON CONFLICT. 2017-06-28 19:00:55 +01:00
common Update copyright in recently added files 2017-07-26 18:17:18 -04:00
datatype Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
executor Move ExecProcNode from dispatch to function pointer based model. 2017-07-30 16:18:21 -07:00
fe_utils Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
foreign Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
lib Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
libpq Always use 2048 bit DH parameters for OpenSSL ephemeral DH ciphers. 2017-07-31 22:36:09 +03:00
mb Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
nodes Fix typo in comment. 2017-08-10 13:14:47 -04:00
optimizer Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
parser Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
port Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
portability Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
postmaster Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
regex Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
replication Fix replication origin-related race conditions 2017-08-08 16:07:46 -04:00
rewrite Teach map_partition_varattnos to handle whole-row expressions. 2017-08-03 11:21:29 -04:00
snowball Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
statistics Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
storage Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
tcop Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
tsearch Fix serious performance problems in json(b) to_tsvector(). 2017-07-18 12:45:51 -04:00
utils Remove AtEOXact_CatCache(). 2017-08-13 16:15:14 -04:00
.gitignore Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
Makefile Add statistics subdirectory to Makefile. 2017-06-08 11:29:50 -04:00
c.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
fmgr.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
funcapi.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
getaddrinfo.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
getopt_long.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
miscadmin.h Change pg_ctl to detect server-ready by watching status in postmaster.pid. 2017-06-28 17:31:32 -04:00
pg_config.h.in Reject use of ucol_strcollUTF8() before ICU 53 2017-08-10 22:14:00 -04:00
pg_config.h.win32 Reject use of ucol_strcollUTF8() before ICU 53 2017-08-10 22:14:00 -04:00
pg_config_ext.h.in Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
pg_config_ext.h.win32 Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
pg_config_manual.h Fix default minimum value for descending sequences 2017-01-23 14:00:58 -05:00
pg_getopt.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_trace.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pgstat.h Fix replication origin-related race conditions 2017-08-08 16:07:46 -04:00
pgtar.h Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
pgtime.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
port.h Change pg_ctl to detect server-ready by watching status in postmaster.pid. 2017-06-28 17:31:32 -04:00
postgres.h Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
postgres_ext.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
postgres_fe.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
rusagestub.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
windowapi.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00