postgresql/src/backend/commands
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
..
Makefile Refactor backend makefiles to remove lots of duplicate code 2008-02-19 10:30:09 +00:00
aggregatecmds.c Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00
alter.c Support ALTER TYPE RENAME. Petr Jelinek 2008-03-19 18:38:30 +00:00
analyze.c Teach ANALYZE to distinguish dead and in-doubt tuples, which it formerly 2008-04-03 16:27:25 +00:00
async.c Move the HTSU_Result enum definition into snapshot.h, to avoid including 2008-03-26 21:10:39 +00:00
cluster.c Phase 2 of project to make index operator lossiness be determined at runtime 2008-04-13 19:18:14 +00:00
comment.c Move the HTSU_Result enum definition into snapshot.h, to avoid including 2008-03-26 21:10:39 +00:00
conversioncmds.c Reduce the need for frontend programs to include "postgres.h" by refactoring 2008-03-27 03:57:34 +00:00
copy.c Rename snapmgmt.c/h to snapmgr.c/h, for consistency with other files. 2008-03-26 18:48:59 +00:00
dbcommands.c Fix two race conditions between the pending unlink mechanism that was put in 2008-04-18 06:48:38 +00:00
define.c Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00
discard.c Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00
explain.c Cause EXPLAIN's VERBOSE option to print the target list (output column list) 2008-04-18 01:42:17 +00:00
functioncmds.c Reduce the need for frontend programs to include "postgres.h" by refactoring 2008-03-27 03:57:34 +00:00
indexcmds.c Move the HTSU_Result enum definition into snapshot.h, to avoid including 2008-03-26 21:10:39 +00:00
lockcmds.c Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00
opclasscmds.c Push index operator lossiness determination down to GIST/GIN opclass 2008-04-14 17:05:34 +00:00
operatorcmds.c Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00
portalcmds.c Revert my bad decision of about a year ago to make PortalDefineQuery 2008-04-02 18:31:50 +00:00
prepare.c Revert my bad decision of about a year ago to make PortalDefineQuery 2008-04-02 18:31:50 +00:00
proclang.c Reduce the need for frontend programs to include "postgres.h" by refactoring 2008-03-27 03:57:34 +00:00
schemacmds.c Make standard maintenance operations (including VACUUM, ANALYZE, REINDEX, 2008-01-03 21:23:15 +00:00
sequence.c Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00
tablecmds.c Fix my brain fade in TRUNCATE triggers patch: can't release relcache refcounts 2008-03-31 03:34:27 +00:00
tablespace.c Move the HTSU_Result enum definition into snapshot.h, to avoid including 2008-03-26 21:10:39 +00:00
trigger.c Support statement-level ON TRUNCATE triggers. Simon Riggs 2008-03-28 00:21:56 +00:00
tsearchcmds.c Move the HTSU_Result enum definition into snapshot.h, to avoid including 2008-03-26 21:10:39 +00:00
typecmds.c Reduce the need for frontend programs to include "postgres.h" by refactoring 2008-03-27 03:57:34 +00:00
user.c Move the HTSU_Result enum definition into snapshot.h, to avoid including 2008-03-26 21:10:39 +00:00
vacuum.c Move the HTSU_Result enum definition into snapshot.h, to avoid including 2008-03-26 21:10:39 +00:00
vacuumlazy.c Move the HTSU_Result enum definition into snapshot.h, to avoid including 2008-03-26 21:10:39 +00:00
variable.c Rename snapmgmt.c/h to snapmgr.c/h, for consistency with other files. 2008-03-26 18:48:59 +00:00
view.c Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00