postgresql/src/backend
Tom Lane 6eedec19f0 Protect against SnapshotNow race conditions in pg_tablespace scans.
Use of SnapshotNow is known to expose us to race conditions if the tuple(s)
being sought could be updated by concurrently-committing transactions.
CREATE DATABASE and DROP DATABASE are particularly exposed because they do
heavyweight filesystem operations during their scans of pg_tablespace,
so that the scans run for a very long time compared to most.  Furthermore,
the potential consequences of a missed or twice-visited row are nastier
than average:

* createdb() could fail with a bogus "file already exists" error, or
  silently fail to copy one or more tablespace's worth of files into the
  new database.

* remove_dbtablespaces() could miss one or more tablespaces, thus failing
  to free filesystem space for the dropped database.

* check_db_file_conflict() could likewise miss a tablespace, leading to an
  OID conflict that could result in data loss either immediately or in
  future operations.  (This seems of very low probability, though, since a
  duplicate database OID would be unlikely to start with.)

Hence, it seems worth fixing these three places to use MVCC snapshots, even
though this will someday be superseded by a generic solution to SnapshotNow
race conditions.

Back-patch to all active branches.

Stephen Frost and Tom Lane
2013-01-18 18:06:50 -05:00
..
access Fix assorted bugs in CREATE INDEX CONCURRENTLY. 2012-11-29 14:52:37 -05:00
bootstrap Avoid changing an index's indcheckxmin horizon during REINDEX. 2011-04-19 18:51:12 -04:00
catalog Fix assorted bugs in CREATE INDEX CONCURRENTLY. 2012-11-29 14:52:37 -05:00
commands Protect against SnapshotNow race conditions in pg_tablespace scans. 2013-01-18 18:06:50 -05:00
executor Add defenses against integer overflow in dynahash numbuckets calculations. 2012-12-11 22:09:39 -05:00
lib Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00
libpq Produce a more useful error message for over-length Unix socket paths. 2012-11-29 19:57:38 -05:00
main Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00
nodes Fix planning of non-strict equivalence clauses above outer joins. 2012-10-18 12:29:19 -04:00
optimizer Fix assorted bugs in CREATE INDEX CONCURRENTLY. 2012-11-29 14:52:37 -05:00
parser Prevent failure when RowExpr or XmlExpr is parse-analyzed twice. 2012-12-23 14:07:52 -05:00
po Translation updates 2012-12-03 07:50:43 -05:00
port Fix Windows implementation of PGSemaphoreLock. 2012-05-10 13:36:33 -04:00
postmaster Fix syslogger so that log_truncate_on_rotation works in the first rotation. 2012-07-31 14:37:18 -04:00
regex Prevent corner-case core dump in rfree(). 2012-07-15 13:28:32 -04:00
rewrite Prevent CREATE TABLE LIKE/INHERITS from (mis) copying whole-row Vars. 2012-06-30 16:44:19 -04:00
snowball Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:12 +02:00
storage Add missing period to detail message. 2012-08-30 13:27:42 -04:00
tcop set_stack_base() no longer needs to be called in PostgresMain. 2012-04-08 19:42:13 +03:00
tsearch Fix bug in to_tsquery(). 2012-05-15 19:27:00 +03:00
utils Add defenses against integer overflow in dynahash numbuckets calculations. 2012-12-11 22:09:39 -05:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:12 +02:00
Makefile Fix PGXS support for building loadable modules on AIX. 2012-10-09 21:04:30 -04:00
nls.mk Install a more robust solution for the problem of infinite error-processing 2008-10-27 19:37:29 +00:00