diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2007-01-27 20:15:55 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2007-01-27 20:15:55 +0000 |
commit | 722ad326f17ab6cf623d350baa9679dcad23088b (patch) | |
tree | e23398200004a90fe111d0079d8011b41f2c28da /src/backend/commands/dbcommands.c | |
parent | 03d128147719acac9de6f7e118525db9370fbf05 (diff) | |
download | postgresql-722ad326f17ab6cf623d350baa9679dcad23088b.tar.gz postgresql-722ad326f17ab6cf623d350baa9679dcad23088b.zip |
Back-port changes of Jan 16 and 17 to "revoke" pending fsync requests during
DROP TABLE and DROP DATABASE. Should prevent unexpected "permission denied"
failures on Windows, and is cleaner on other platforms too since we no longer
have to take it on faith that ENOENT is okay during an fsync attempt.
Patched as far back as 8.1; per recent discussion I think we are not going
to worry about Windows-specific issues in 8.0 anymore.
Diffstat (limited to 'src/backend/commands/dbcommands.c')
-rw-r--r-- | src/backend/commands/dbcommands.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c index 5fa0f6155df..e12b7be4070 100644 --- a/src/backend/commands/dbcommands.c +++ b/src/backend/commands/dbcommands.c @@ -15,7 +15,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.173.2.1 2005/11/22 18:23:07 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.173.2.2 2007/01/27 20:15:55 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -42,6 +42,7 @@ #include "storage/fd.h" #include "storage/freespace.h" #include "storage/procarray.h" +#include "storage/smgr.h" #include "utils/acl.h" #include "utils/array.h" #include "utils/builtins.h" @@ -665,6 +666,12 @@ dropdb(const char *dbname) FreeSpaceMapForgetDatabase(db_id); /* + * Tell bgwriter to forget any pending fsync requests for files in the + * database; else it'll fail at next checkpoint. + */ + ForgetDatabaseFsyncRequests(db_id); + + /* * On Windows, force a checkpoint so that the bgwriter doesn't hold any * open files, which would cause rmdir() to fail. */ |