postgresql/src/backend/utils
Tom Lane 84333962ea Fix incorrect order of operations during sinval reset processing.
We have to be sure that we have revalidated each nailed-in-cache relcache
entry before we try to use it to load data for some other relcache entry.
The introduction of "mapped relations" in 9.0 broke this, because although
we updated the state kept in relmapper.c early enough, we failed to
propagate that information into relcache entries soon enough; in
particular, we could try to fetch pg_class rows out of pg_class before
we'd updated its relcache entry's rd_node.relNode value from the map.

This bug accounts for Dave Gould's report of failures after "vacuum full
pg_class", and I believe that there is risk for other system catalogs
as well.

The core part of the fix is to copy relmapper data into the relcache
entries during "phase 1" in RelationCacheInvalidate(), before they'll be
used in "phase 2".  To try to future-proof the code against other similar
bugs, I also rearranged the order in which nailed relations are visited
during phase 2: now it's pg_class first, then pg_class_oid_index, then
other nailed relations.  This should ensure that RelationClearRelation can
apply RelationReloadIndexInfo to all nailed indexes without risking use
of not-yet-revalidated relcache entries.

Back-patch to 9.0 where the relation mapper was introduced.
2011-08-16 14:38:29 -04:00
..
adt Replace errdetail("%s", ...) with errdetail_internal("%s", ...). 2011-07-16 14:22:35 -04:00
cache Fix incorrect order of operations during sinval reset processing. 2011-08-16 14:38:29 -04:00
error Reduce PG_SYSLOG_LIMIT to 900 bytes. 2011-08-05 21:02:52 -04:00
fmgr Replace errdetail("%s", ...) with errdetail_internal("%s", ...). 2011-07-16 14:22:35 -04:00
hash Fix the size of predicate lock manager's shared memory hash tables at creation. 2011-04-11 13:43:31 +03:00
init Fix incorrect timeout handling during initial authentication transaction. 2011-08-13 17:52:41 -04:00
mb Fix char2wchar/wchar2char to support collations properly. 2011-04-23 12:35:41 -04:00
misc Replace errdetail("%s", ...) with errdetail_internal("%s", ...). 2011-07-16 14:22:35 -04:00
mmgr Cleanup for pull-up-isReset patch. 2011-05-24 17:57:32 -04:00
resowner pgindent run before PG 9.1 beta 1. 2011-04-10 11:42:00 -04:00
sort Fix failure to account for memory used by tuplestore_putvalues(). 2011-06-15 14:05:39 -04:00
time Remove special case for xmin == xmax in HeapTupleSatisfiesVacuum(). 2011-04-29 16:29:42 -04:00
.gitignore Avoid maintaining three separate copies of the error codes list. 2011-02-03 22:32:49 -05:00
errcodes.txt Per-column collation support 2011-02-08 23:04:18 +02:00
Gen_dummy_probes.sed Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
Gen_fmgrtab.pl Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
generate-errcodes.pl Avoid maintaining three separate copies of the error codes list. 2011-02-03 22:32:49 -05:00
Makefile Make handling of errcodes.h more consistent with other generated headers. 2011-02-04 09:29:10 -05:00
probes.d Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00