postgresql/contrib/sepgsql
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
..
expected sepgsql: One more getObjectIdentity in lieu of getObjectDescription. 2013-04-17 09:52:59 -04:00
sql sepgsql: Enforce db_procedure:{execute} permission. 2013-04-12 08:58:01 -04:00
.gitignore Minor sepgsql regression test fixes. 2011-02-02 23:46:51 -05:00
Makefile Take sepgsql regression tests out of the regular regression test mechanism. 2011-09-27 20:07:15 -04:00
database.c sepgql: Use getObjectIdentity rather than getObjectDescription. 2013-04-12 08:35:55 -04:00
dml.c sepgql: Use getObjectIdentity rather than getObjectDescription. 2013-04-12 08:35:55 -04:00
hooks.c pgindent run for release 9.3 2013-05-29 16:58:43 -04:00
label.c Use an MVCC snapshot, rather than SnapshotNow, for catalog scans. 2013-07-02 09:47:01 -04:00
launcher Update copyrights for 2013 2013-01-01 17:15:01 -05:00
proc.c pgindent run for release 9.3 2013-05-29 16:58:43 -04:00
relation.c pgindent run for release 9.3 2013-05-29 16:58:43 -04:00
schema.c pgindent run for release 9.3 2013-05-29 16:58:43 -04:00
selinux.c Allow sepgsql labels to depend on object name. 2013-03-28 15:41:38 -04:00
sepgsql-regtest.te sepgsql: Enforce db_procedure:{execute} permission. 2013-04-12 08:58:01 -04:00
sepgsql.h sepgsql: Enforce db_procedure:{execute} permission. 2013-04-12 08:58:01 -04:00
sepgsql.sql.in sepgsql_setcon(). 2012-03-15 16:08:40 -04:00
test_sepgsql sepgsql: Minor improvement to test script, doc fix. 2013-04-17 09:55:24 -04:00
uavc.c Allow sepgsql labels to depend on object name. 2013-03-28 15:41:38 -04:00