postgresql/src/include/storage
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
..
backendid.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
barrier.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
block.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
buf.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
buf_internals.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
buffile.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
bufmgr.h Add buffer_std flag to MarkBufferDirtyHint(). 2013-06-17 08:02:12 -07:00
bufpage.h pgindent run for release 9.3 2013-05-29 16:58:43 -04:00
checksum.h Refactor checksumming code to make it easier to use externally. 2013-06-13 22:35:56 -04:00
checksum_impl.h Fix cpluspluscheck in checksum code 2013-06-30 10:25:43 -04:00
copydir.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
fd.h Add support for piping COPY to/from an external program. 2013-02-27 18:22:31 +02:00
freespace.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
fsm_internals.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
indexfsm.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
ipc.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
item.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
itemid.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
itemptr.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
large_object.h pgindent run for release 9.3 2013-05-29 16:58:43 -04:00
latch.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
lmgr.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
lock.h Add noreturn attributes to some error reporting functions 2013-02-12 07:13:22 -05:00
lwlock.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
off.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
pg_sema.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
pg_shmem.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
pmsignal.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
pos.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
predicate.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
predicate_internals.h pgindent run for release 9.3 2013-05-29 16:58:43 -04:00
proc.h Add lock_timeout configuration parameter. 2013-03-16 23:22:57 -04:00
procarray.h Ensure no xid gaps during Hot Standby startup 2013-06-23 11:05:02 +01:00
procsignal.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
reinit.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
relfilenode.h pgindent run for release 9.3 2013-05-29 16:58:43 -04:00
s_lock.h Add ARM64 (aarch64) support to s_lock.h. 2013-06-04 15:42:02 -04:00
shmem.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
sinval.h Use an MVCC snapshot, rather than SnapshotNow, for catalog scans. 2013-07-02 09:47:01 -04:00
sinvaladt.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
smgr.h Accelerate end-of-transaction dropping of relations 2013-01-17 16:13:17 -03:00
spin.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
standby.h pgindent run for release 9.3 2013-05-29 16:58:43 -04:00