postgresql/src/backend
Heikki Linnakangas 9cb91f90c9 Fix two race conditions between the pending unlink mechanism that was put in
place to prevent reusing relation OIDs before next checkpoint, and DROP
DATABASE. First, if a database was dropped, bgwriter would still try to unlink
the files that the rmtree() call by the DROP DATABASE command has already
deleted, or is just about to delete. Second, if a database is dropped, and
another database is created with the same OID, bgwriter would in the worst
case delete a relation in the new database that happened to get the same OID
as a dropped relation in the old database.

To fix these race conditions:
- make rmtree() ignore ENOENT errors. This fixes the 1st race condition.
- make ForgetDatabaseFsyncRequests forget unlink requests as well.
- force checkpoint on in dropdb on all platforms

Since ForgetDatabaseFsyncRequests() is asynchronous, the 2nd change isn't
enough on its own to fix the problem of dropping and creating a database with
same OID, but forcing a checkpoint on DROP DATABASE makes it sufficient.

Per Tom Lane's bug report and proposal. Backpatch to 8.3.
2008-04-18 06:48:38 +00:00
..
access Clean up a few places where Datums were being treated as pointers (and vice 2008-04-17 21:37:28 +00:00
bootstrap Move the HTSU_Result enum definition into snapshot.h, to avoid including 2008-03-26 21:10:39 +00:00
catalog Create new routines systable_beginscan_ordered, systable_getnext_ordered, 2008-04-12 23:14:21 +00:00
commands Fix two race conditions between the pending unlink mechanism that was put in 2008-04-18 06:48:38 +00:00
executor Since createplan.c no longer cares whether index operators are lossy, it has 2008-04-13 20:51:21 +00:00
lib Refactor backend makefiles to remove lots of duplicate code 2008-02-19 10:30:09 +00:00
libpq Use error message wordings for permissions checks on .pgpass and SSL private 2008-03-31 02:43:14 +00:00
main Refactor backend makefiles to remove lots of duplicate code 2008-02-19 10:30:09 +00:00
nodes Push index operator lossiness determination down to GIST/GIN opclass 2008-04-14 17:05:34 +00:00
optimizer Fix a couple of oversights associated with the "physical tlist" optimization: 2008-04-17 21:22:14 +00:00
parser Push index operator lossiness determination down to GIST/GIN opclass 2008-04-14 17:05:34 +00:00
po Translation updates 2008-01-31 18:04:52 +00:00
port Repair two places where SIGTERM exit could leave shared memory state 2008-04-16 23:59:40 +00:00
postmaster Teach ANALYZE to distinguish dead and in-doubt tuples, which it formerly 2008-04-03 16:27:25 +00:00
regex Refactor backend makefiles to remove lots of duplicate code 2008-02-19 10:30:09 +00:00
rewrite Move the HTSU_Result enum definition into snapshot.h, to avoid including 2008-03-26 21:10:39 +00:00
snowball Implement a few changes to how shared libraries and dynamically loadable 2008-04-07 14:15:58 +00:00
storage Fix two race conditions between the pending unlink mechanism that was put in 2008-04-18 06:48:38 +00:00
tcop Revert addition of pg_terminate_backend() because of race conditions. 2008-04-15 20:28:47 +00:00
tsearch Simplify and standardize conversions between TEXT datums and ordinary C 2008-03-25 22:42:46 +00:00
utils Cause EXPLAIN's VERBOSE option to print the target list (output column list) 2008-04-18 01:42:17 +00:00
Makefile Enable probes to work with Mac OS X Leopard and other OSes that will 2008-03-17 19:44:41 +00:00
common.mk We need to rebuild objfiles.txt when one of the subdirectories' objfiles.txt 2008-03-17 18:24:56 +00:00
nls.mk Add a new ereport auxiliary function errdetail_log(), which works the same as 2008-03-24 18:08:47 +00:00