postgresql/src/include/utils
Robert Haas 568d4138c6 Use an MVCC snapshot, rather than SnapshotNow, for catalog scans.
SnapshotNow scans have the undesirable property that, in the face of
concurrent updates, the scan can fail to see either the old or the new
versions of the row.  In many cases, we work around this by requiring
DDL operations to hold AccessExclusiveLock on the object being
modified; in some cases, the existing locking is inadequate and random
failures occur as a result.  This commit doesn't change anything
related to locking, but will hopefully pave the way to allowing lock
strength reductions in the future.

The major issue has held us back from making this change in the past
is that taking an MVCC snapshot is significantly more expensive than
using a static special snapshot such as SnapshotNow.  However, testing
of various worst-case scenarios reveals that this problem is not
severe except under fairly extreme workloads.  To mitigate those
problems, we avoid retaking the MVCC snapshot for each new scan;
instead, we take a new snapshot only when invalidation messages have
been processed.  The catcache machinery already requires that
invalidation messages be sent before releasing the related heavyweight
lock; else other backends might rely on locally-cached data rather
than scanning the catalog at all.  Thus, making snapshot reuse
dependent on the same guarantees shouldn't break anything that wasn't
already subtly broken.

Patch by me.  Review by Michael Paquier and Andres Freund.
2013-07-02 09:47:01 -04:00
..
.gitignore Avoid maintaining three separate copies of the error codes list. 2011-02-03 22:32:49 -05:00
acl.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
array.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
ascii.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
attoptcache.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
builtins.h Improve updatability checking for views and foreign tables. 2013-06-12 17:53:33 -04:00
bytea.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
cash.h Add casts from int4 and int8 to numeric. 2011-04-05 09:35:43 -04:00
catcache.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
combocid.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
date.h Clean up references to SQL92 2013-04-20 11:04:41 -04:00
datetime.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
datum.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
dynahash.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
dynamic_loader.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
elog.h pgindent run for release 9.3 2013-05-29 16:58:43 -04:00
evtcache.h pgindent run for release 9.3 2013-05-29 16:58:43 -04:00
fmgrtab.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
formatting.h Fix to_char() to use ASCII-only case-folding rules where appropriate. 2013-03-05 13:02:30 -05:00
geo_decls.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
guc.h Revoke bc5334d867 2013-03-28 09:18:02 +00:00
guc_tables.h pgindent run for release 9.3 2013-05-29 16:58:43 -04:00
help_config.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
hsearch.h Prevent very-low-probability PANIC during PREPARE TRANSACTION. 2013-01-13 22:20:22 -05:00
inet.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
int8.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
inval.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
json.h Add new JSON processing functions and parser API. 2013-03-29 14:12:13 -04:00
jsonapi.h pgindent run for release 9.3 2013-05-29 16:58:43 -04:00
logtape.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
lsyscache.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
memdebug.h Cooperate with the Valgrind instrumentation framework. 2013-06-26 20:22:25 -04:00
memutils.h Permit super-MaxAllocSize allocations with MemoryContextAllocHuge(). 2013-06-27 14:53:57 -04:00
nabstime.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
numeric.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
palloc.h Permit super-MaxAllocSize allocations with MemoryContextAllocHuge(). 2013-06-27 14:53:57 -04:00
pg_crc.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
pg_crc_tables.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
pg_locale.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
pg_lzcompress.h Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
pg_rusage.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
plancache.h pgindent run for release 9.3 2013-05-29 16:58:43 -04:00
portal.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
ps_status.h Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
rangetypes.h SP-GiST support of the range adjacent operator -|- 2013-03-08 15:03:19 +02:00
rbtree.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
rel.h pgindent run for release 9.3 2013-05-29 16:58:43 -04:00
relcache.h Provide database object names as separate fields in error messages. 2013-01-29 17:08:26 -05:00
relmapper.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
reltrigger.h pgindent run for release 9.3 2013-05-29 16:58:43 -04:00
resowner.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
resowner_private.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
selfuncs.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
snapmgr.h Use an MVCC snapshot, rather than SnapshotNow, for catalog scans. 2013-07-02 09:47:01 -04:00
snapshot.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
sortsupport.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
spccache.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
syscache.h Use an MVCC snapshot, rather than SnapshotNow, for catalog scans. 2013-07-02 09:47:01 -04:00
timeout.h Add lock_timeout configuration parameter. 2013-03-16 23:22:57 -04:00
timestamp.h Clean up references to SQL92 2013-04-20 11:04:41 -04:00
tqual.h Improve concurrency of foreign key locking 2013-01-23 12:04:59 -03:00
tuplesort.h Permit super-MaxAllocSize allocations with MemoryContextAllocHuge(). 2013-06-27 14:53:57 -04:00
tuplestore.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
typcache.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
tzparser.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
uuid.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
varbit.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
xml.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00